接口入参的sort字段一般是‘roneMthRor desc'这种,所以下面需要对sort进行切分后判断,当前是升序还是降序的样式,
代码示例:
const field = sort.split(' ')[0] || '';
const order = sort.split(' ')[1] || '';
{
dataIndex: 'roneMthRor',
title: '近一月收益',
align: 'right',
sorter: true,
sortOrder: (sort === '' || field !== 'roneMthRor') ? null : order === 'asc' ? 'ascend' : 'descend',
render: (text: string = '') => {
return (
<span>{text || '--'}</span>
);
},
},
**antd Table columns 配置sorter,表格每次刷新排序状态怎么重置?
于 2023-11-15 17:08:29 首次发布