async checkDriver(mobile) {
this.$axios({
url: "xxx",
method: "POST",
data: {
mobile: mobile
}
}).then(res => {
console.log("========="+res.status);
return res.data.status;
}).catch(error => {
this.$message.error(error.toString());
return -1;
});
},
addValidate() {
this.$refs['form'].validate((valid) => {
if (valid) {
let status = await this.checkDriver(this.form.mobile);
console.log(status);
} else {
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
未解析的变量或类型 await.Highlights 可能旨在异步但缺少 async 修饰符的函数。如何在 => 中使用 await?给我一些帮助。谢谢