-
最后一列不设置宽度。因为antd会自己给最后一列分配宽度;
-
设置合适的宽度。推荐用百分比设置宽度。
-
scroll属性中的x选择一个合适的值(或者直接设为 max-content)
scroll={{ x: 'max-content', y: tableHeight() }}
4.给Table组件设置这个中英文都换行的样式
style={{ wordBreak: 'break-all' }}
<Table
bordered
loading={props.showTableLoading}
dataSource={myCompanyList.list || []}
columns={columns}
scroll={{ x: 'max-content', y: tableHeight() }}
style={{ wordBreak: 'break-all' }}
/>
- 让滚动条宽度不计算。
.ant-table-small>.ant-table-content .ant-table-header{
overflow-y: overlay !important;
}
.ant-table-fixed-header>.ant-table-content>.ant-table-scroll>.ant-table-body{
overflow-y: overlay !important;
}
原文链接:https://blog.csdn.net/jingshui1234/article/details/116481149