项目中需要大屏幕数据展示,于是使用了dataV组件,但是使用是发现拖动浏览器边框,dataV组件显示异常,如图:

于是查了官网,官网的解释如下:

 

于是按照官网的意思编写代码:

<dv-active-ring-chart ref="pie2" :config="config" :key="key" class="datav-item" />
 return {
      pieOutline: '',
      key : 1,
 }
methods: {
    pieOutlineFunc () {
      var _this=this
      window.addEventListener('resize', function(e){
        _this.$nextTick(()=>{
          console.log(_this.$refs.pie2)
          _this.key++
        })
      })
    }
  },
  mounted () {
    this.pieOutlineFunc()
  },

于是可以自适应了

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐