在对象遍历中去字符串截取某个字段而后赋值给这个字段的坑

此坑比较大vue

场景:this

vue子组件拿父组件的传值,[{},{}]结构的,父组件为2014-02-04 03:55:33,子组件须要过滤改变为02-04 03:55:33spa

filterDataAddClassName(list) {
      let _this = this;
      if (Object.keys(list).length > 0) {
        return list.map(item => {
          item.cellClassName = {
            id: `level-class-style-${item.alarmLevel}`
          };
          // item.callTime = item.callTime.substring(5);
          // console.log(item.callTime);
          let nTime = item.callTime.substring(5);
          item.NewCallTime = nTime;
          return item;
        });
      }
    },

正常写法为注释code

可是这样会出现一个问题,多是相同内存的递归???反正会一直截取字符串,不明白为何blog

可是我用了一个新值去放这个处理的,就ok了递归

相关文章
相关标签/搜索