vue 加速

 

1. index.htmlcss

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <link rel="shortcut icon" href="<%= BASE_URL %>favicon.ico">
    <link rel="stylesheet" href="https://at.alicdn.com/t/font_740572_wb164twbrom.css">
    <script src="https://cdn.bootcss.com/echarts/4.1.0-release/echarts.min.js"></script>
    <script src="https://cdn.bootcss.com/babel-polyfill/7.6.0/polyfill.min.js"></script>
    <script src="https://cdn.bootcss.com/axios/0.19.0-beta.1/axios.min.js"></script>
    <script src="https://cdn.bootcss.com/qs/6.8.0/qs.min.js"></script>
    <script src="https://cdn.bootcss.com/moment.js/2.22.2/moment.min.js"></script>
    <script src="https://cdn.bootcss.com/moment.js/2.22.2/locale/zh-cn.js"></script>

    <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/xlsx/0.15.1/xlsx.min.js"></script>
    <script src="https://unpkg.com/element-ui@2.8.2/lib/index.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/element-ui@2.8.2/lib/theme-chalk/index.css">
    <title>管理系統</title>
</head>
<body>
<noscript>
    <strong>We're sorry but vms doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
</body>
</html>

 

 

2. vue.config.jshtml

productionSourceMap: false,
    configureWebpack: {
        externals: {
            'vue': 'Vue',
            'vue-router': 'VueRouter',
            // 'vuex': 'Vuex',
            "moment": "moment",
            'echarts': 'echarts',
            'axios': 'axios',
            'qs': 'Qs',
            'xlsx': 'xlsx',
            'element-ui': 'ELEMENT'
        }
    },

 

3. 去掉import vue

 

4. CDN 資源ios

https://www.bootcdn.cn/vue-router

https://unpkg.com/vuex

 

參考:element-ui

https://www.jianshu.com/p/f4a4f2bfb1e3json

https://blog.csdn.net/moakun/article/details/81041554axios

相關文章
相關標籤/搜索