js中数组删除对象

2023-12-03  本文已影响0人  李小白呀

1.slice

let index = this.ruleForm.cybmList.findIndex(obj => obj.orgId == row.orgId)
      this.ruleForm.cybmList = this.ruleForm.cybmList.slice(0, index).concat(this.ruleForm.cybmList.slice(index + 1))

2.去重

this.form.zjlist = this.form.zjlist.filter((item, index) =>
        this.form.zjlist.findIndex(i => i.id === item.id) === index);
      console.log(this.form.zjlist);

3.连接

this.bumenNumber = this.bumenNumber.concat(ret.data)
上一篇 下一篇

猜你喜欢

热点阅读