【Vue】SPA优化

时间:2020-02-04 18:05:43   收藏:0   阅读:63

cdn引入

CDN(内容分发网络),是构建在现有网络基础之上的智能虚拟网络,依靠部署在各地的边缘服务器,通过中心平台的负载均衡、内容分发、调度等功能模块,使用户就近获取所需内容,降低网络拥塞,提高用户访问响应速度和命中率。

静态资源托管库:https://www.bootcdn.cn/

在public/index.html中cdn引入vue、vuex、vue-router

    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.min.js"></script>
    <script src="https://cdn.bootcss.com/vuex/3.1.1/vuex.min.js"></script>
    <script src="https://cdn.bootcss.com/vue-router/3.1.3/vue-router.min.js"></script>
    <script src="https://cdn.bootcss.com/element-ui/2.12.0/index.js"></script>

在vue.config.js中

module.exports = {
  lintOnSave: false,
  configureWebpack: {
    externals: {
      vue: ‘Vue‘,
      vuex: ‘Vuex‘,
      ‘vue-router‘: ‘VueRouter‘,
      ‘element-ui‘: ‘element-ui‘, // 这里有点疑问,element cdn引入后这里不用这行代码也OK
    },
  },
};

  

 

原文:https://www.cnblogs.com/Mijiujs/p/12260120.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!