1、看官網,按照官網的步驟來
2、關於移動端的自適應問題
用到的是echarts中的resize()方法,具體步驟如下
由與vue-echarts中用到的是v-chart標簽,所以使用方法與echarts中的使用又有點兒不同
// 結構
<div style="height:300px;width:100%;padding-top:40px;"> <!-- <v-chart :options="polar" /> --> <!-- 折線圖 --> <v-chart ref="mypolar" :options="line" id="myLine" /> <!-- 柱狀圖 --> <!-- <v-chart :options="bar" /> --> </div>
// 在methods中 resizeChart() { if (this.$refs.myline) { this.$refs.myline.resize() console.log('1111') } if (this.$refs.mypolar) { this.$refs.mypolar.resize() console.log('222') } }
// 在mounted中調用 mounted() { window.addEventListener('resize', this.resizeChart) // this.drawLine() }
3、待補充其他的