安装
yarn add echarts vue-echarts
引入 在main.js中
import 'echarts'
import ECharts from 'vue-echarts'
Vue.component('VueEcharts', ECharts)
使用
<VueEcharts :option="option_column" style="height: 400px"></VueEcharts>
option_column: {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
legend: {
icon: 'roundRect',
data: ['累计平均日活']
},
series: [
{
name: '累计平均日活',
data: [150, 230, 224, 218, 135, 147, 260],
type: 'line'
}
]
}