vue 查询某个对象在对象列表的索引位置
Posted 饕
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue 查询某个对象在对象列表的索引位置相关的知识,希望对你有一定的参考价值。
vue 查询某个对象在对象列表的索引位置
let a = {
id: 1,
name: \'wjw\'
}
let mList= [{
id: 1,
name: \'wjw\'
}, {
id: 2,
name: \'zqx\'
}]
let index = mList.findIndex(item => {
return item.id === a.id;
});
// index 会返回0, 如果没有,返回 -1
以上是关于vue 查询某个对象在对象列表的索引位置的主要内容,如果未能解决你的问题,请参考以下文章