1, html introduced echarts
html script tag is added as follows:
<script src="//cdn.bootcss.com/echarts/4.2.1/echarts.simple.min.js"></script>
2, configured to use the echarts CDN in webpack
In vue.config.js configuration as follows:
module.exports = {
configureWebpack: {
externals: {
'Echarts': 'echarts' // use the CDN configuration
}
}
}
The key externals for import, value indicates that the access to the global object, is window.echarts
3, in vue file
Use echarts in vue in time without import echarts, can be used directly