首页 > 其他 > 详细

修改 vuex $store.state 里取出的数据不响应

时间:2020-04-03 21:15:16      阅读:426      评论:0      收藏:0      [点我收藏+]

一定要先拷贝

 

let { showLabel, actualValue } = this.record;
      let show = this.rowData[showLabel];
      let actual = this.rowData[actualValue];
      const { formGroup } = this.$store.state.right;
      const { dispatch } = this.$store;
      let group = _.cloneDeep(formGroup) // 这一步必须, 如果直接 formGroup.map( ... ) 数据响应不到
      const newFormGroup = group.map(item => {
        if (item.componentx === "modal") {
          item = {
            ...item,
            uniqueKey:createUuid()
          }
          return (item = {
            ...item,
            initValue: show,
            actualValue: actual
          });
        } else {
          return item;
        }
      });
      dispatch("right/updateFormGroup", newFormGroup);
      this.visible = false;

 

修改 vuex $store.state 里取出的数据不响应

原文:https://www.cnblogs.com/winyh/p/12628925.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!