Element - UI <el-table-column>多选数据提交后禁用已提交的多选框

  1. 通过 @selection-change="selectionChange" 将已选择的数据存入selectData数组中
复制代码
<el-table :data="tableData" class="my-5" @selection-change="selectionChange" >

//多选框已选择的数据
const selectData = ref([]);
const selectionChange = (data) => {
  selectData.value = data;
}
  1. 提交按钮绑定提交事件

    <el-button type="primary" @click="sub">提交</el-button>

提交后将已提交的数据提交状态设置为true

复制代码
const sub=()=>{
  selectData.value.forEach(item => {
    item.submitted = true;
  });
}
  1. 通过 type="selection" 设置属性为多选框

通过 :selectable="checkSelectSet" 将提交的数据多选框设为禁用状态

复制代码
<el-table-column type="selection" width="50" align="center" :selectable="selectable"/>

属性 selectable是否不禁用状态后面跟自定义的方法名

复制代码
const selectable = (row,index) => {
    return !row.submitted;
};

//return : false  就是禁用
//return : true  不禁用
相关推荐
chilavert3181 分钟前
技术演进中的开发沉思-274 AJax :Button
前端·javascript·ajax·交互
Robet1 分钟前
static 和 lib/assets资源区别
前端·svelte
名字被你们想完了3 分钟前
Flutter 实现一个容器内部元素可平移、缩放和旋转等功能(九)
前端·flutter
千寻girling5 分钟前
面试官: “ 说一下你对 Cookie 的理解 ? ”
前端·后端
RedHeartWWW8 分钟前
nextjs中,关于Layout组件和Page组件的认知
前端·react.js
大明二代9 分钟前
基于 Microsoft Graph API 与 React Email 构建现代化邮件发送系统
前端·react.js·microsoft
sujiu11 分钟前
eslint匹配规则速通
前端
Zyx200712 分钟前
用 Vue 3 构建任务清单:响应式编程的优雅实践
前端
风止何安啊13 分钟前
那些让你 debug 到凌晨的陷阱,我帮你踩平了:React Hooks 避坑指南
前端·react.js·面试
用户2796560427014 分钟前
wx微信小程序部分逻辑
前端