要在选中提交时清空多选框,可以在handlesumit()函数中添加以下代码:

this.selectedRows = []; // 清空选中的行

修改后的代码如下:

handlesumit() {
  this.loading = true;
  let data = this.selectedRows.map((row) => row);
  let voucherId = this.selectedRows.map((row) => row.voucherId);
  // let data=this.selectedRows.map((row) => row);
  if (!this.voucherGroupId && !this.voucherId) {
    return;
  }
  console.log("voucherIdList", this.selectedRows);
  let formData = new FormData();
  formData.append("voucherGroupId", this.voucherGroupId);
  formData.append("voucherIdList", voucherId);
  console.log("voucherIdList", voucherId);
  console.log(" this.voucherGroupId", this.voucherGroupId);
  addVoucherList(formData)
    .then((res) => {
      console.log(res, "formData");
      const newtable = [...this.tabledata, ...data];
      this.tabledata = newtable;
      console.log(this.tabledata, "this.tabledata");
      this.getVoucherList();
      this.open = false;
      this.loading = false;
      this.selectedRows = []; // 清空选中的行
    });
},

这样,在提交查询凭证时就会清空多选框的选中状态。

怎么在选中提交的时候清空多选框 提交查询凭证按钮 handlesumit thisloading = true; let data = thisselectedRowsmaprow = row; let voucherId = thisselectedRowsmaprow = rowvoucherId; let data=thissel

原文地址: https://www.cveoy.top/t/topic/i7fW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录