现象:table表格中表头的全选复选框,在表格没有数据的情况下是禁选的,但依然能点击选中
image.png
解决:
在el-table中添加@select-all方法,当没有选中数据时,清空选择
image.png
image.png
<el-table
ref="tree"
:data="tableData"
@select-all="selectAll"
@selection-change="handleSelectionChange"
>
</el-table>
selectAll(value){
if(value.length==0){
this.$refs.tree.clearSelection()
}
}