vue-cli3 used in the project CDN

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

Guess you like

Origin www.cnblogs.com/ivan5277/p/11926547.html
Recommended