数组中的指定某一项放置第一位

const arr = []
this.todoLeftList.forEach((item) => {
arr.push(item.srcSystemCode)
})
const index = arr.indexOf('zldc')
if (index) {
const first = this.todoLeftList.splice(index, 1)[0]
this.todoLeftList.unshift(first)
}

 

const arr = []
this.todoLeftList.forEach((item) => {
arr.push(item.srcSystemCode)
})
const index = arr.indexOf('zldc')
if (index) {
const first = this.todoLeftList.splice(index, 1)[0]
this.todoLeftList.unshift(first)
}
posted @ 2023-11-20 22:58  无泪的遗憾、愿我能  阅读(36)  评论(0)    收藏  举报
浏览器标题切换
浏览器标题切换end