this.Phenomenon.forEach(element => { if (element.value3 == this.prvphe) { this.Reason1 = element.Children } }) const obj1 = { id: 100, value4: '其他' } this.Reason1.push(obj1) //forEach循环可以取到数组中对象 取到对象后就可以进行下一层数组的赋值或者更改某个值 下面是数组的push方法新增对象
import _ from 'lodash' this.CloneReason2 = _.cloneDeep(this.Reason2) //复制数组可以用lodash
//删除可以用splice this.CloneReason2.splice(2, 3) //lodash的话可以用drop等 但是要重新在赋值一次 this.CloneReason2 = _.drop(this.CloneReason2, 10)
//复制数组 利用concat骚操作下 不连接任何值 arr = [1, 2, 3] arr1 = [] arr1 = arr.concat() console.log(arr1);