基础样式完成

This commit is contained in:
aixianling
2024-09-06 15:43:07 +08:00
parent 6118304302
commit f888c81508
4 changed files with 117 additions and 21 deletions

View File

@@ -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>