我正在使用Ionic开发一个使用SweetAlert2库的移动应用。当点击swal页脚中的链接时,我想关闭模态,用加载器代替常用按钮。
swal({
title: 'Title',
type: 'info',
html: 'Do something',
showConfirmButton: false,
allowOutsideClick: false,
allowEscapeKey: false,
footer: '<a href="#" onclick="swal.close(); return false;">Done</a>'
});
swal.showLoading();
模态启动没问题但是当我点击链接时,控制台中会抛出一个错误 - “Uncaught ReferenceError:swal is not defined”。
调用此功能的正确方法是什么?谢谢!