是的,Ant Design表格的表头支持多列排序。可以在排序属性中传入一个数组来实现。示例代码:
其中,columns为表格列的配置,data为数据源,onChange为排序回调函数。在columns配置中,需要指定每列的sorter属性,并将其赋值为一个函数。函数需要返回一个数字,-1表示降序,0表示不排序,1表示升序。示例代码: const columns = [ { title: 'Name', dataIndex: 'name', sorter: (a, b) => a.name.localeCompare(b.name), sortDirections: ['descend', 'ascend'], }, { title: 'Age', dataIndex: 'age', sorter: (a, b) => a.age - b.age, sortDirections: ['descend', 'ascend'], }, ];
在示例代码中,sorter属性指定了排序函数,sortDirections属性指定了排序方向。如果省略sortDirections,则默认支持升序和降序两种排序方式。