美文网首页
element-ui的table表格多选限制个数,隐藏全选按钮

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