【发布时间】:2018-04-10 10:15:04
【问题描述】:
我尝试了这个简单的文档示例https://sweetalert2.github.io/,但我收到了错误消息:
未捕获的语法错误:await 仅在异步函数中有效
$(document).ready(function() {
$('.buttonproblem').click(function() {
const { value : text } = await swal({
input: 'textarea',
inputPlaceholder: 'Type your message here',
showCancelButton: true
})
if (text) {
swal(text)
}
})
});
【问题讨论】:
-
但我使用了文档的示例及其工作原理? sweetalert2.github.io
-
能否请您链接到显示此使用模式的文档
-
为什么需要 await 和 async 来显示消息?
标签: jquery sweetalert2