问题表述
表格设置允许横向滚动
<a-table :columns="columns" :data-source="data" bordered :scroll="{ x: '100%' }" />
单元格定义了宽度
columns: [
{
title: '产品线',
dataIndex: 'line',
key: 'line',
customRender: this.renderContent
},
{
title: '产品名称',
dataIndex: 'name',
key: 'name',
width: '6rem'
},
{
title: '所属项目',
dataIndex: 'belongproject',
key: 'belongproject',
width: '6rem'
}
]
导致单元格文字不换行而是直接溢出,糊在了一起!
解决方法
在样式里设置允许换行
.ant-table .ant-table-body .ant-table-thead th,
.ant-table .ant-table-body .ant-table-tbody td {
white-space: normal;
}
突然发现官网有说明,下次看文档一定认真一点!!!