0
点赞
收藏
分享

微信扫一扫

使用findIndex查找并做一些操作


1.查找指定数据并删除

let findIndex = arrItemsApprover.findIndex(item=>item.zusrid===oObject.zusrid);

if (findIndex!==-1){
	arrItemsApprover.splice(findIndex, 1);
}

2.查找指定数据并添加属性

arrData.forEach(item => {
    if (selectApproveUserData.findIndex(i=>item.zusrid===i.zusrid) !== -1) {
        item.selected = true;
    }else{
        item.selected = false;
    }
});


举报

相关推荐

0 条评论