用computed定义一个changeData对象吧,然后再去watch changeData

computed: {
      changeData() {
        const { index, columName,columData} = this
        return {
          index,
          columName,
          columData,
        }
      }
    },
    watch: {
      changeData: {
        handler: function (newval, oldval) {
          this.index = newval.index;
          this.columName = newval.columName;
          this.columData = newval.columData;
          let length = this.columName.length;
          let end = 700/length-1; // 横坐标展示7类
          let show = false;
          if(length >7){
            show = true;
          }
          this.buildChart(this.columLabel,this.columName,this.columData,show,end);
        },
        deep: true
      }
    }
Logo

前往低代码交流专区

更多推荐