两个数组对象合并后放至el-table组件报错:You may have an infinite update loop

后端传过来的数组对象不能满足需求需要给数组对象中的item再加一个数组,类似这种格式:[{a:1,b:2, c:[{d:6, w:9}]}],c就是新增加的key,然后选择的数组和现有的数组合并到this.productList,再渲染到el-table,el-table可以展开含有子表,这样就报错了You may have an infinite update loop in a component render function. found in,请问大神怎么解决这样的报错,谢谢!(以下是报错的函数)

图片.png

getSelectData(val) {
        if (this.productList.length) {
       this.productList = this.productList.concat(val);
      } else {
        this.productList = val;
      }
    this.productList.forEach((item, index) => {
            if(!item.ordersDetails){
              let obj = {};
              item.ordersDetails = [];
              obj.country = item.country;
              obj.platform = item.platform;
              obj.shopCode = item.shopCode;
              item.ordersDetails.push(obj);
            }
      });
}
阅读 1.3k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题