数组中数组去除一个值

1、// 移除表扬单个照片

  //  for (var i in this.TzForm.praise.image) {
      //         for (var k in this.TzForm.praise.image[i]) {
      //            if (this.TzForm.praise.image[i][k] == file.uid) {
      //                delete this.TzForm.praise.image[i];
      //             break;
      //             }
      //         }
      //     }

// this.TzForm.praise.forEach(item => { // item.image.forEach(items => { // items.url != file.url; // }); // });

//过滤不符合的一个,等于删除了一个 // this.TzForm.praise = this.TzForm.praise.filter(item => item.url != file.url);

// this.TzForm.praise = this.TzForm.praise.forEach(item => // item.image.filter(items => { // items.url != file.url; // }) // );

//数组里数组循环遍历两次,去除一个 for (let i = 0; i < this.TzForm.praise.length; i++) { for (let j = 0; j < this.TzForm.praise[i].image.length; j++) { if (file.url == this.TzForm.praise[i].image[j].url) { this.TzForm.praise[i].image.splice(j, 1); } } }

 

posted @ 2020-06-04 13:36  看到我的div了吗?  阅读(371)  评论(0编辑  收藏  举报