首先要创一个echars图表实例。我是用vue写的。 <script> export default {   data() {     return {       chartInstance: null,    }  } 运用生命钩子在监听窗口改变事件,当窗口发生变化时执行echars的resize方法. mounted() {   window.onresize = () => {      this.chartInstance.resize()  } }, methods: { // 初始化echarts图表给chartInstance 赋值   drawLine() {     let dom = this.$refs.chart     this.chartInstance = this.$echarts.init(dom, 'light')     // 图表清空缓存     this.chartInstance.clear()     this.chartInstance.setOption(this.chartOptions, true)   } } <script>

 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄