sweetalert

Response from Sweet-alert confirm dialog

不羁的心 提交于 2019-11-28 09:34:15
I have a function where i costumize my sweet-alert dialog. I want to use it in a lot of places and therefore set that in a function like: $rootScope.giveConfirmDialog = function(title,text,confirmButtonText,toBeExecFunction){ swal({title: title, text: title, ..... confirmButtonText: confirmButtonText }, toBeExecFunction); } What i want to do is simple: calling that function in somewhere and go on based on the answer of the user, thus: var res = $scope.$root.giveConfirmDialog("..", "test", "test", function () { return true; }); But i don't take any response. Actually, i couldn't find such an

Laravel NPM包的使用

只愿长相守 提交于 2019-11-27 09:57:09
示例:安装sweetalert插件 1.yarn add sweetalert 2. resources/js/bootstrap.js中引入: require('sweetalert');    $(document).ready(function() { // 删除按钮点击事件 $('.btn-del-address').click(function() { // 获取按钮上 data-id 属性的值,也就是地址 ID var id = $(this).data('id'); // 调用 sweetalert swal({ title: "确认要删除该地址?", icon: "warning", buttons: ['取消', '确定'], dangerMode: true, }) .then(function(willDelete) { // 用户点击按钮后会触发这个回调函数 // 用户点击确定 willDelete 值为 true, 否则为 false // 用户点了取消,啥也不做 if (!willDelete) { return; } // 调用删除接口,用 id 来拼接出请求的 url axios.delete('/user_addresses/' + id) .then(function () { // 请求成功之后重新加载页面 location.reload();

Response from Sweet-alert confirm dialog

旧城冷巷雨未停 提交于 2019-11-27 03:00:03
问题 I have a function where i costumize my sweet-alert dialog. I want to use it in a lot of places and therefore set that in a function like: $rootScope.giveConfirmDialog = function(title,text,confirmButtonText,toBeExecFunction){ swal({title: title, text: title, ..... confirmButtonText: confirmButtonText }, toBeExecFunction); } What i want to do is simple: calling that function in somewhere and go on based on the answer of the user, thus: var res = $scope.$root.giveConfirmDialog("..", "test",