async handleDelete() {
let folderFilesIds = [1, 2]
this.$confirm('此操作将永久删除文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
await this.confirmHandleFiles(folderFilesIds)
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
之前报错Unexpected reserved word ‘await’,是因为错把async放到handleDelete上,这里async和await是成对出现的,所以应该放在匿名函数的位置,加async的函数会被await阻塞,await会跳出async让出线程,所以说学一个东西是一回事,会用一个东西是另外一回事
转: https://blog.csdn.net/weixin_49651654/article/details/122139353
Original: https://www.cnblogs.com/fps2tao/p/16343858.html
Author: 与f
Title: element 报错:Unexpected reserved word ‘await’
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/548982/
转载文章受原作者版权保护。转载请注明原作者出处!