current position:Home>Ant vue3 table sorted by time

Ant vue3 table sorted by time

2022-05-15 02:02:55rojie0

**columns  Sort **
const columns = [
{
    
    key: 'createdate',
    title: ' Creation time ',
    dataIndex: 'createdate',
    // Default sort   In reverse order :undescend  positive sequence :descend 
    defaultSortOrder: 'descend',   
    hideInSearch: true,
    sorter: (a, b) => {
    
     //  Convert to timestamp 
      const aTime = new Date(a.createdate).getTime();
      const bTime = new Date(b.createdate).getTime();
      return aTime - bTime;
    },
  }
 ]

copyright notice
author[rojie0],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/132/202205120528099173.html

Random recommended