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


一定要先拷贝

 

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;

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM