可以使用CSS来解决这个问题,为列设置一个最小宽度即可。
示例代码如下:
.ant-table table { table-layout: fixed; } .ant-table thead th { position: sticky; top: 0; } .ant-table tbody td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; /* 设置最大宽度 / } .ant-table tbody td[data-th]::before { content: attr(data-th) "\A"; white-space: pre; } .ant-table td:nth-child(2) { min-width: 100px; / 设置最小宽度 */ }