vue开发: then里面包着async, await

async,await是配合使用的,一般的操作:

        async test() {
          const res = await ajax();
        }

then里面包着async, await的代码:

        test() {
          this.$confirm("是否提交?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
          })
            .then(async () => {
              const res = await ajax();
            })
            .catch(() => { });
        }

你可能感兴趣的:(vue开发: then里面包着async, await)