<!-- table部分 -->
<el-table ref="table" :data="tableData" style="margin-top: 20px" row-key="ID" default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}" :row-class-name="rowClassNameFun" @select="select" @select-all="selectAll"> <el-table-column type="selection" width="50"></el-table-column>// JS部分
// 初始化数据,将数据都用isSelect标记一下,isSelect为false不选中、true选中、half半选 添加子集的父级ID initData (data) { data.forEach((item) => { item.isSelect = false // 默认为不选中 if (item.children && item.children.length > 0) {
elementui table树形多选、半选、全选解决方案
2024-01-19 13:36:04 51 阅读