element-ui的el-switch 点击时,保持当前状态不变并弹窗提示

遇到问题:点击开关后,弹窗之后还未进行选择,状态已经改变了
原因: 数据绑定使用的是v-model
解决:改成:value


handleStatusChange(row) {
      let text = row.status == "0" ? "停用" : "启用";
      this.$confirm('确认要"' + text + '""' + row.userName + '"用户吗?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return changeUserStatus(row.userId, status);
        }).then(() => {
          this.msgSuccess(text + "成功");
          this.getList();
        }).catch(function() {
          
        });
    },

你可能感兴趣的:(element-ui的el-switch 点击时,保持当前状态不变并弹窗提示)