2019-12-03 Antd Design of Vue中将t
2019-12-03 本文已影响0人
柒李香
Sharpen
最新发布在最上面
放到计算属性中,dataSource为后台获取的数据,sortedArticles为table中的数据
computed: {
sortedArticles: function () {
return this.dataSource.sort(function (a, b) {
let aTimeString = a.createTime
let bTimeString = b.createTime
aTimeString = aTimeString.replace(/-/g, '/')
bTimeString = bTimeString.replace(/-/g, '/')
let aTime = new Date(aTimeString).getTime()
let bTime = new Date(bTimeString).getTime()
return bTime - aTime
})
}
}
参考链接
https://blog.csdn.net/weixin_35252758/article/details/81045787