async和await是成对出现的。会报上边的错是因为没有把async放在和await最近的函数上。
举例:
报错代码:
1 async confirmAll() { 2 this.$refs['editeForm'].validate((valid) => { 3 if (valid) { 4 const { success } = await retrievePassword(this.formline) 5 if (success) { 6 this.$message.success('操作成功!') 7 } 8 } 9 }) 10 }
修改后:
1 confirmAll() { 2 this.$refs['editeForm'].validate(async(valid) => { 3 if (valid) { 4 const { success } = await retrievePassword(this.formline) 5 if (success) { 6 this.$message.success('操作成功!') 7 } 8 } 9 }) 10 }
标签:Unexpected,reserved,success,await,valid,报错,async From: https://www.cnblogs.com/heisetianshi/p/17086002.html