From 85cea1e0a8ad56e91700703e8b47560cd31a7e03 Mon Sep 17 00:00:00 2001 From: yma16 <17685043634@163.com> Date: Mon, 17 Oct 2022 01:24:34 +0800 Subject: [PATCH] =?UTF-8?q?perf:=E6=B7=BB=E5=8A=A0=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=9A=84=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/webpack.prod.conf.js | 82 +++++++++++++++++------------------ src/components/Article.vue | 48 ++++++++++++++++++-- src/components/Bilicom.vue | 4 +- src/echarts/Map.vue | 3 +- src/main.js | 28 ++++++------ src/store/index.js | 10 +---- src/weather/EchartWeather.vue | 2 +- 7 files changed, 108 insertions(+), 69 deletions(-) diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index 6199f9e..b68e7e1 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -20,47 +20,47 @@ const env = let externalModules = {} //cdn 配置 let externalConfig = [] -// if (process.env.NODE_ENV === 'production') { -// //生产环境 -// externalModules = { -// vue: 'Vue', -// 'vue-router': 'VueRouter', -// vuex: 'Vuex', -// axios: 'axios', -// 'element-ui': 'element-ui', -// echarts: 'echarts', -// highlight: 'hljs', -// } -// externalConfig = [ -// {js: 'https://cdn.jsdelivr.net/npm/vue@2.5.2/dist/vue.js', css: ''}, -// { -// js: 'https://cdn.bootcdn.net/ajax/libs/vue-router/3.0.1/vue-router.min.js', -// css: '', -// }, -// {js: 'https://unpkg.com/axios/dist/axios.min.js', css: ''}, -// {js: 'https://cdn.bootcss.com/vuex/3.6.2/vuex.min.js', css: ''}, -// { -// js: 'https://unpkg.com/element-ui/lib/index.js', -// css: 'https://unpkg.com/element-ui/lib/theme-chalk/index.css', -// }, -// { -// js: 'https://cdn.jsdelivr.net/npm/echarts@5.3.3/dist/echarts.min.js', -// css: '', -// }, -// { -// js: 'https://cdn.bootcdn.net/ajax/libs/highlight.js/11.6.0/highlight.min.js', -// css: '', -// }, -// { -// js: '', -// css: 'https://cdn.bootcdn.net/ajax/libs/github-markdown-css/5.1.0/github-markdown-light.min.css', -// }, -// { -// js: '', -// css: 'https://cdn.bootcdn.net/ajax/libs/nprogress/0.2.0/nprogress.css', -// }, -// ] -// } +if (process.env.NODE_ENV === 'production') { + //生产环境 + externalModules = { + vue: 'Vue', + 'vue-router': 'VueRouter', + vuex: 'Vuex', + axios: 'axios', + 'element-ui': 'element-ui', + echarts: 'echarts', + highlight: 'hljs', + } + externalConfig = [ + {js: 'https://cdn.jsdelivr.net/npm/vue@2.5.2/dist/vue.js', css: ''}, + { + js: 'https://cdn.bootcdn.net/ajax/libs/vue-router/3.0.1/vue-router.min.js', + css: '', + }, + {js: 'https://unpkg.com/axios/dist/axios.min.js', css: ''}, + {js: 'https://cdn.bootcss.com/vuex/3.6.2/vuex.min.js', css: ''}, + { + js: 'https://unpkg.com/element-ui/lib/index.js', + css: 'https://unpkg.com/element-ui/lib/theme-chalk/index.css', + }, + { + js: 'https://cdn.jsdelivr.net/npm/echarts@5.3.3/dist/echarts.min.js', + css: '', + }, + { + js: 'https://cdn.bootcdn.net/ajax/libs/highlight.js/11.6.0/highlight.min.js', + css: '', + }, + { + js: '', + css: 'https://cdn.bootcdn.net/ajax/libs/github-markdown-css/5.1.0/github-markdown-light.min.css', + }, + { + js: '', + css: 'https://cdn.bootcdn.net/ajax/libs/nprogress/0.2.0/nprogress.css', + }, + ] +} const webpackConfig = merge(baseWebpackConfig, { externals: externalModules, //打包忽略 diff --git a/src/components/Article.vue b/src/components/Article.vue index e67dab3..f7a339a 100644 --- a/src/components/Article.vue +++ b/src/components/Article.vue @@ -82,8 +82,9 @@ class="weather_class1" cellpadding="1px" shadow="always" - style="position: static; margin-top: 2%" + style="position: static; margin-top: 2%;text-align: center" > + 爬取天气预报