小编wok*_*oki的帖子

vue:语法错误:await 是保留字

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?给我一些帮助。谢谢

javascript vue.js vuejs2

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

javascript ×1

vue.js ×1

vuejs2 ×1