data-view的水位图,动态刷新时有重影的解决

data-view的水位图控件。在vue里用js赋值自动刷新水位值时,发现会出现重影。

刷新函数内的代码:

      this.water.data = [parseInt(realproduction*100/planproduction))]
      this.water = {...this.water}
      console.log(this.water.data)

每次刷新发现内容都写对的。但是却有重影。
刷新函数在vue页面事件的created和mounted里都有注册,并且设置为定时刷新。感觉 有重复,就从created方法中去掉了。去掉之后重影也消失,显示正常。对js刚接触,具体原因还不清楚。

mounted() {
this.queryInfo();
this.timer = setInterval(() => {
setTimeout(this.queryInfo, 0);
}, 1000 * 60); // 刷新定时时长60秒
},

created() {
// this.queryInfo();
},

参考页面:
https://blog.csdn.net/qq_46566911/article/details/109635852

猜你喜欢

转载自blog.csdn.net/weixin_40433334/article/details/116840891