link : https://www.cnblogs.com/strinkbug/p/5786222.html
一、i在html中添加script標籤如下:
<script src="//cdn.bootcss.com/echarts/3.2.2/echarts.simple.min.js"></script>
二、在webpack中配置echarts 在webpack.base.conf.js文件內添加external選項,在module.exports內部,和entry平級;
externals: {
"echarts": "echarts"
},
externals中的key是給import的時候用的,value表示的是如何在global中訪問到該對象,這裏是window.echarts
三、在需要使用echart的vue頁面引入echart
import echarts from 'echarts'
this.myChart = echarts.init(document.getElementById('line1'))
this.myChart.setOption(option)