this.tableData = res.data.sort((a, b) => {
return Number(a.字段名) - Number(b.字段名) //正序
//return Number(b.字段名) - Number(a.字段名) //反序
})
这种方法用来排序的字段值是数字
this.tableData = res.data.sort((a, b) => {
return Number(a.字段名) - Number(b.字段名) //正序
//return Number(b.字段名) - Number(a.字段名) //反序
})
这种方法用来排序的字段值是数字
本文标题:对象数组排序
本文链接:https://www.haomeiwen.com/subject/gpnyaltx.html
网友评论