const this.optionsBack=[{code:A,age:11},{code:B,age:12},{code:C,age:13}]
this.optionsBack.sort((a, b) => {
return a.code > b.code ? 1 : -1
})
对象数组里按照字母顺序排序
最新推荐文章于 2023-07-07 23:30:18 发布
const this.optionsBack=[{code:A,age:11},{code:B,age:12},{code:C,age:13}]
this.optionsBack.sort((a, b) => {
return a.code > b.code ? 1 : -1
})