link : https://www.cnblogs.com/strinkbug/p/5786222.htmlcss
1、i在html中添加script标签以下:html
<script src="//cdn.bootcss.com/echarts/3.2.2/echarts.simple.min.js"></script>vue
2、在webpack中配置echarts 在webpack.base.conf.js文件内添加external选项,在module.exports内部,和entry平级;webpack
externals: {web
"echarts": "echarts"echarts
},this
externals中的key是给import的时候用的,value表示的是如何在global中访问到该对象,这里是window.echartscdn
3、在须要使用echart的vue页面引入echarthtm
import echarts from 'echarts'对象
this.myChart = echarts.init(document.getElementById('line1'))
this.myChart.setOption(option)