如题,查了一些方法,都无效。
比如:
<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>
写个样式覆盖一下嘛。
🔗 Element Plus Playground