刚开始的两个数组是这样的,b数组是在a数组的基础上加了一个字段a=[{label:'周一',organizeId:'1001'},{label:'周二',organizeId:'1002'},{label:'周三',organizeId:'1003'},{label:'周四',organizeId:'1004'},{label:'周五',organizeId:'1005'}]b=[{children:[{label:'周一',organizeId:'1001',subValue:'100'},{label:'周二',organizeId:'1002',subValue:'200'},{label:'周三',organizeId:'1003',subValue:'1000'},{label:'周四',organizeId:'1004',subValue:'800'},{label:'周五',organizeId:'1005',subValue:'600'}]},{children:[{label:'周一',organizeId:'1001',subValue:'100'},{label:'周二',organizeId:'1002',subValue:'200'},{label:'周三',organizeId:'1003',subValue:'1000'},{label:'周四',organizeId:'1004',subValue:'800'},{label:'周五',organizeId:'1005',subValue:'600'}]}]当a的数据变化之后a=[{label:'周一',organizeId:'1001'},{label:'周二',organizeId:'1002'},{label:'周六',organizeId:'1006'}]我想得到这样的数组,之前有的数据不变,没有的比如周六,就加上并将subValue值设为0,去掉的,比如周三,周四,周五,新的数组里的children里也去掉b=[{children:[{label:'周一',organizeId:'1001',subValue:'100'},{label:'周二',organizeId:'1002',subValue:'200'},{label:'周六',organizeId:'1006',subValue:'0'}]},{children:[{label:'周一',organizeId:'1001',subValue:'100'},{label:'周二',organizeId:'1002',subValue:'200'},{label:'周六',organizeId:'1006',subValue:'0'}]}]
摇曳的蔷薇
芜湖不芜
相关分类