ant design vue 日期排序


參考ant design內Table表頭日期字段排序

moment方法,僅用於處理日期格式

import moment from 'moment'

sorter為組件內字段


        {
          title: '截止日期',
          width: 150,
          align: "center",
          dataIndex: 'endTime',
          sorter: (a, b) => {
            return new Date(a.endTime) > new Date(b.endTime) ? 1 : -1;
          },
          customRender: function (text){
            if(text == '' || text == null){
              return '/';
            } else {
              return moment(text).format("YYYY-MM-DD");
            }
          }
        },


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM