element 报错:Unexpected reserved word 'await'
作者:互联网
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
标签:folderFilesIds,reserved,await,Unexpected,报错,async,message 来源: https://www.cnblogs.com/fps2tao/p/16343858.html