element-ui的table表格多选限制个数,隐藏全选按钮
作者:
我是七月 | 来源:发表于
2024-07-17 15:36 被阅读0次<el-table ref="courseList" :data="courseList" row-key="id" @selection-change="handleCourseSelection">
//...
<el-table>
//方法
handleCourseSelection(selection) {
// console.log(selection);
if(selection.length > 2) {
this.$message.warning(`最多只能选择2个课程`);
let del_row = selection.pop()
this.$refs.courseList.toggleRowSelection(del_row, false)
} else {
this.selsectionCourse = selection
}
},
//在样式里面增加这个可以隐藏全选框
::v-deep .el-table__header-wrapper .el-checkbox {
// display: none;//设置不成功,页面卡顿
visibility: hidden;
}
本文标题:element-ui的table表格多选限制个数,隐藏全选按钮
本文链接:https://www.haomeiwen.com/subject/jekchjtx.html
网友评论