sweetalert2

sweetalert2 multiple swal at the same function

南楼画角 提交于 2020-05-13 19:25:05
问题 I'd like to make a condition and call a swal for each one (Sweetalert2). But only one of the swal runs. How can I do it? function validateEmail(email) { var regex = /\S+@\S+\.\S+/; return regex.test(email); } function validateBirth(data) { var regex = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/; return regex.test(data); } function validacao() { var data = document.getElementById('birth').value; var email = document.getElementById('email').value; if (!validateBirth(data)) { swal( 'title..', 'text..

Adding class to sweet alert

只谈情不闲聊 提交于 2020-02-03 07:59:27
问题 I am trying to add an extra class for my modal so I can select it from LESS and turn it's background to transparent. But customClass is not working. Is there any other way to do it. BTW I have already changed a lot with default classes so I need to do this for just one modal, can not effect the global swal. swal({ title: success, showConfirmButton: false, html: true, customClass: ".swal-back" }); 回答1: The customClass option has been removed. You need to use className now instead. The period

Using sweetalert 2 with custom html and AngularJS

拥有回忆 提交于 2020-01-05 20:31:23
问题 I am using SweetAlert2 with AngularJS, using this port to AngularJS 1.x : https://github.com/socialbase/angular-sweetalert-2. I am trying to add some custom html in my swal, so when I do this: angular.module('app').controller('TestController', function($scope, SweetAlert) { $scope.test = "My test"; SweetAlert.swal({ type: 'warning', html: '<input type="text" ng-model="test">' }).then(function() { }); }); It binds the html correctly, but it isn't binding ng-model using my variable test .

Sweetalert 2 textarea async

六眼飞鱼酱① 提交于 2020-01-04 01:36:09
问题 I tried with this simple example of documentation https://sweetalert2.github.io/ but i get the error message : Uncaught SyntaxError: await is only valid in async function $(document).ready(function() { $('.buttonproblem').click(function() { const { value : text } = await swal({ input: 'textarea', inputPlaceholder: 'Type your message here', showCancelButton: true }) if (text) { swal(text) } }) }); 回答1: The issue is because you need to declare the click handler function as async in order to use

Sweetalert2 Ajax - post input data

人盡茶涼 提交于 2020-01-03 17:35:13
问题 I have recently been working with SweetAlert2 on my project, and I would like to put together a "Add Note" feature. User clicks on a button, gets directed to a page, and the following executes. <script>swal({ title: "Add Note", input: "textarea", showCancelButton: true, confirmButtonColor: "#1FAB45", confirmButtonText: "Save", cancelButtonText: "Cancel", buttonsStyling: true }).then(function () { swal( "Sccess!", "Your note has been saved!", "success" ) }, function (dismiss) { if (dismiss ===

Show SweetAlert2 over Bootstrap modal

流过昼夜 提交于 2019-12-25 00:14:09
问题 I've tried to add a sweetalert component over bootstrap's modal, the problem was that the modal has an atribute 'tabindex' and the focus property was not working as expected, I found a solution that i want to complement, I removed the 'tabindex' attribute and then set focus on the button that I wanted. If you have another solution, i'd like to know it! sweet.fire({ position: 'top', title: 'ARE YOU SURE TO UPDATE THIS ITEM?', type: 'info', showCancelButton: true, confirmButtonColor: '#3085d6',

How to call method i sweetalert 2

老子叫甜甜 提交于 2019-12-24 08:16:24
问题 In my angular 4 project I am using a theme with sweetalert 2, I want to call my method when user click on the confirm button, but it seems that I can't call any method inside then function swal({ title: 'Are you sure?', text: "You won't be able to revert this!", type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', confirmButtonText: 'Yes, delete it!' }).then(function () { // I want to call my method here but I can't do this.myMethod() }) I know It

Vue.js 2- sweet alert package simplert not working

眉间皱痕 提交于 2019-12-24 01:26:00
问题 I would like to use this library for alerts in my app built with Laravel 5.2 version. I have installed it and created a component like this: <script> import Simplert from 'vue2-simplert' export default { data () { return { obj: { title: 'Alert Title', message: 'Alert Message', type: 'info', useConfirmBtn: true, customConfirmBtnText: 'OK' }, } }, methods: { openSimplert () { this.$refs.simplert.openSimplert(this.obj) }, } } </script> I am registering the component in my app.js like this: Vue

Vue.js+Node.js+Mongodb+Express+Bootstrap搭建个人博客

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-17 03:04:16
1 概述 花了半年时间学习,然后开发的个人博客,目前我的博客正在使用。 博客前端展示页面见这里,顺便安利一波小站,嘻嘻 。 后台管理部分如图。 后台首页。 后台管理,包括博客的删除、修改和是否隐藏。 写博客。 2 技术栈 前端使用到的技术有: vue vue-router vuex bootstrap-vue 前端用到的插件有: sweetalert2 (弹出框,注意有2,不是sweetalert,两个用法有较大差别) mavon-editor (markdown语法编辑器) vue-axios (ajax) vue-backtotop (回到顶部按钮) sha1 @voerro/vue-tagsinput (标签输入) 后端用到的技术栈有: node.js express mongodb mongoose multer jsonwebtoken 后端用到的插件有: config-lite (方便配置) body-parser express-winston (记录请求日志) 3 技术点详解 **注意,本博客源码使用的是vue脚手架创建的项目。所以下面的部分都是针对脚手架项目而言的哟。**源码文章末尾会给出链接。 3.1 技术图谱 技术图谱其实就是svg,当然这不是一个一个点用代码写出来的,使用 svg编辑器 绘制出来的。 是个体力活来的。我个人画了两个,一个用在移动端

js-jquery-SweetAlert2【二】配置与方法

落爺英雄遲暮 提交于 2019-12-17 00:46:31
一、配置 Argument Default value Description title null 模态对话框的标题。它可以在参数对象的 title 参数中设置,也可以在 swal() 方法的第一个参数设置。 The title of the modal, as HTML. It can either be added to the object under the key "title" or passed as the first parameter of the function. titleText null 模态对话框的内容。 The title of the modal, as text. Useful to avoid HTML injection. text null 模态对话框的内容。它可以在参数对象的 text 参数中设置,也可以在 swal() 方法的第二个参数设置。 A description for the modal. It can either be added to the object under the key "text" or passed as the second parameter of the function. html null 对话框中的内容作为HTML标签。如果同时提供 text 和 html 参数,插件将会优先使用