1.通过以下命令安装echarts
npm install echarts –save
2.在main.js文件里全局引入echarts
import echarts from ‘echarts’
Vue.prototype.$echarts = echarts
3.单页面引用echarts
import echarts from ‘echarts’
// html代码
123
// js代码
import echarts from 'echarts'
export default {
name: 'aaa',
data () {
return {
xData: [],
tionData: [],
noData: false
}
},
methods: {
// echarts渲染
statistics () {
var myChart
myChart = echarts.init(document.getElementById('myECharts'))
myChart.setOption({
title: {
text: '对比图',
x: 'center',
y: 'bottom',
textStyle: {
color: '#666666',
font