vben admin TableAction 控制表格某一列不显示
时间: 2023-07-16 18:15:31 浏览: 419
您可以在 `TableAction` 组件中使用 `columns` 属性来控制表格中某一列的显示与隐藏。具体做法是:
1. 在 `data()` 方法中定义表格的列信息,包括需要隐藏的列:
```
data() {
return {
columns: [
{ title: '列1', key: 'col1' },
{ title: '列2', key: 'col2' },
{ title: '列3', key: 'col3' },
{ title: '列4', key: 'col4', hidden: true }, // 需要隐藏的列
],
...
}
}
```
2. 在 `TableAction` 组件中使用 `columns` 属性,并将需要隐藏的列的 `hidden` 属性设置为 `true`:
```
<template>
<admin-table-action :columns="columns" ... />
</template>
<script>
import AdminTableAction from '@/components/AdminTableAction.vue'
export default {
components: { AdminTableAction },
data() {
return {
columns: [
{ title: '列1', key: 'col1' },
{ title: '列2', key: 'col2' },
{ title: '列3', key: 'col3' },
{ title: '列4', key: 'col4', hidden: true }, // 需要隐藏的列
],
...
}
},
...
}
</script>
```
这样,在表格中就不会显示设置为 `hidden: true` 的列了。
阅读全文
相关推荐


















