正确写法:要在valid前面使用async
/**提交 */
handleSubmit() {
this.$refs["form"].validate(async valid => {
if (valid) {
await this.handleUploadFile();
}
ApiUpdateOrganBrand(this.form).then(res => {
console.log(res);
this.$message.success("品牌配置成功");
this.handleClose();
});
});
},
我开始是在handleSubmit前面写的async,报 Unexpected reserved word ‘await’。
原文链接:https://m.imooc.com/wenda/detail/609228

在Element UI的表单提交过程中,遇到使用await报错的问题。错误信息为'Unexpected reserved word ‘await’'。解决办法是将async关键字置于valid之前。详细解答可参考原文链接:https://m.imooc.com/wenda/detail/609228。
210

被折叠的 条评论
为什么被折叠?



