vue3, element ui Plus 中的 el-table组件, 如何隐藏全选框?

如题,查了一些方法,都无效。

比如:

<template>
  <el-table
    :data="tableData"
    @selection-change="handleSelectionChange"
    :header-cell-class-name="hideHeaderCheckbox"
  >
    <el-table-column type="selection" width="55" />
    <!-- 其他列 -->
  </el-table>
</template>

<style scoped>
/* 隐藏全选框 */
::v-deep .hide-checkbox .el-checkbox {
  display: none;
}
</style>

<script>
export default {
  methods: {
    // 为表头单元格添加自定义类名
    hideHeaderCheckbox({ row, column, rowIndex }) {
      if (column.type === 'selection') {
        return 'hide-checkbox';
      }
      return '';
    }
  }
};
</script>

阅读 660
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题