vue单页应用首次加载太慢之性能优化
问题描述:
<script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script> <script src="https://cdn.bootcss.com/vue-router/3.0.1/vue-router.min.js"></script> <script src="https://cdn.bootcss.com/element-ui/2.4.0/index.js"></script> <script src="https://cdn.bootcss.com/echarts/3.7.0/echarts.min.js"></script>
<!-- 引入 cdn 资源 --> <script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script>
<script> //<![CDATA[ if (typeof Vue == 'undefined') { document.write(unescape("%3Cscript src='https://cdn.staticfile.org/vue/2.6.10/vue.min.js' %3E%3C/script%3E")); } //]]> </script> <script src="https://cdn.bootcss.com/vue-router/3.0.1/vue-router.min.js"></script> <script> //<![CDATA[ if (typeof VueRouter == 'undefined') { document.write(unescape("%3Cscript src='https://cdn.staticfile.org/vue-router/3.0.7/vue-router.min.js' %3E%3C/script%3E")); } //]]> </script> <script src="https://cdn.bootcss.com/element-ui/2.4.0/index.js"></script> <script> //<![CDATA[ if (typeof ELEMENT == 'undefined') { document.write(unescape("%3Cscript src='https://cdn.staticfile.org/element-ui/2.10.1/index.js' %3E%3C/script%3E")); } //]]> </script> <script src="https://cdn.bootcss.com/echarts/3.7.0/echarts.min.js"></script> <script> //<![CDATA[ if (typeof echarts == 'undefined') { document.write(unescape("%3Cscript src='https://cdn.staticfile.org/echarts/4.2.1-rc1/echarts-en.min.js' %3E%3C/script%3E")); } //]]> </script>
externals: { 'vue': 'Vue', 'vue-router': 'VueRouter', 'element-ui': 'ELEMENT', "echarts": "echarts", },
下面再补充一些其它优化:
http://www.bejson.com/ui/compress_img/