排序

2019-05-16  本文已影响0人  晚安_bd35

中文首字母

this.dakaManageList.sort((x, y) => {

 return x["name"].localeCompare(y["name"])

 })

根据时间排序

this.dakaManageList.sort((a, b) => {

 let aTime = new Date(a.recardTime.replace(/-/g,'/')).getTime()

 let bTime = new Date(b.recardTime.replace(/-/g,'/')).getTime()

   return aTime - bTime

 })

data{

list:[],

arr:[]

}

1、获取数组里面多个对象

let res=await this.getDataState(this.obj)

this.list =res.data.rows

let chu;

this.list.map(item =>{

chu=item

return chu

})

console.log('chu1',JSON.stringify(chu))

2、对个对象中的key  把key  push到数组里 在通过数组的索引号拿到你想要的某个key

for(var key in chu){

this.arr.push(key)

// return list

}

上一篇下一篇

猜你喜欢

热点阅读