0
点赞
收藏
分享

微信扫一扫

Ant Vue3 表格按时间排序

WikongGuan 2022-05-06 阅读 66
**columns 排序**
const columns = [
{
    key: 'createdate',
    title: '创建时间',
    dataIndex: 'createdate',
    // defaultSortOrder: 'descend',
    hideInSearch: true,
    sorter: (a, b) => {
     // 需要先转		换成时间戳
      const aTime = new Date(a.createdate).getTime();
      const bTime = new Date(b.createdate).getTime();
      return aTime - bTime;
    },
  }
 ]
举报

相关推荐

0 条评论