我的antd版本是1.7.5支持这种写法吗
时间: 2023-08-11 15:03:48 浏览: 55
很抱歉,`showHeader` 属性是从 Antd 2.x 版本开始引入的,因此在 Antd 1.7.5 版本中不支持该属性。不过,你可以通过 CSS 来隐藏表头,例如:
```html
<template>
<a-table :columns="columns" :data-source="dataSource" class="custom-table"></a-table>
</template>
<script>
export default {
data() {
return {
columns: [
{
title: '姓名',
dataIndex: 'name',
},
{
title: '年龄',
dataIndex: 'age',
},
{
title: '地址',
dataIndex: 'address',
},
],
dataSource: [
{
key: '1',
name: '张三',
age: 18,
address: '北京市',
},
{
key: '2',
name: '李四',
age: 20,
address: '上海市',
},
{
key: '3',
name: '王五',
age: 22,
address: '广州市',
},
],
};
},
};
</script>
<style scoped>
.custom-table .ant-table-thead {
display: none;
}
</style>
```
上述代码使用 CSS 来隐藏表头,即通过 `.custom-table .ant-table-thead { display: none; }` 来将表头隐藏。你可以根据自己的需求来调整样式。