基础样式完成
This commit is contained in:
		@@ -7,8 +7,6 @@
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "AiEchart",
 | 
			
		||||
  props: {
 | 
			
		||||
@@ -112,7 +110,6 @@ export default {
 | 
			
		||||
        this.getChartData(oldDims != current)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    theme() {
 | 
			
		||||
      this.refresh()
 | 
			
		||||
    }
 | 
			
		||||
@@ -139,16 +136,13 @@ export default {
 | 
			
		||||
      this.chart.setOption(this.chartOptions || {})
 | 
			
		||||
    },
 | 
			
		||||
    watchResize() {
 | 
			
		||||
      this.timer && clearInterval(this.timer)
 | 
			
		||||
      this.timer = setInterval(() => {
 | 
			
		||||
      window.onresize = () => {
 | 
			
		||||
        const {clientHeight, clientWidth} = this.$refs.AiEchart || {},
 | 
			
		||||
            h = this.chart?.getHeight(), w = this.chart?.getWidth()
 | 
			
		||||
        if (h != clientHeight || w != clientWidth) {
 | 
			
		||||
          this.chart?.resize()
 | 
			
		||||
        }
 | 
			
		||||
      }, 1000)
 | 
			
		||||
      //5分钟后停止监听
 | 
			
		||||
      setTimeout(() => this.timer && clearInterval(this.timer), 5 * 60 * 1000)
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    refresh() {
 | 
			
		||||
      this.chart.setOption(this.chartOptions || {})
 | 
			
		||||
@@ -160,9 +154,6 @@ export default {
 | 
			
		||||
      this.initChart()
 | 
			
		||||
      this.getChartData()
 | 
			
		||||
    })
 | 
			
		||||
  },
 | 
			
		||||
  beforeDestroy() {
 | 
			
		||||
    this.timer && clearInterval(this.timer)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user