From 6e862ac968a90fe127b4857c2be145cb247571dd Mon Sep 17 00:00:00 2001 From: xpnas Date: Sat, 27 Mar 2021 20:25:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=AF=E7=94=A8CDN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Inotify.Vue/package.json | 10 +- Inotify.Vue/public/favicon.ico | Bin 67646 -> 1150 bytes Inotify.Vue/public/index.html | 36 +++-- Inotify.Vue/src/main.js | 22 +-- Inotify.Vue/src/views/404.vue | 241 ++++----------------------------- Inotify.Vue/vue.config.js | 80 +++++++---- 6 files changed, 107 insertions(+), 282 deletions(-) diff --git a/Inotify.Vue/package.json b/Inotify.Vue/package.json index 8959592..a80f107 100644 --- a/Inotify.Vue/package.json +++ b/Inotify.Vue/package.json @@ -1,5 +1,5 @@ { - "name": "Inotify-vue", + "name": "inotify", "version": "0.0.1", "description": "WebControl for Inotify", "author": "", @@ -15,18 +15,16 @@ }, "dependencies": { "axios": "0.18.1", - "core-js": "3.6.5", "echarts": "^4.9.0", - "element-plus": "^1.0.2-beta.32", "element-ui": "2.13.2", "js-cookie": "2.2.0", - "moment": "^2.29.1", "normalize.css": "7.0.0", "nprogress": "0.2.0", "path-to-regexp": "2.4.0", + "moment": "2.29.1", "vue": "2.6.10", - "vue-router": "3.0.6", - "vuex": "3.1.0" + "vuex": "3.1.0", + "vue-router": "3.0.6" }, "devDependencies": { "@vue/cli-plugin-babel": "4.4.4", diff --git a/Inotify.Vue/public/favicon.ico b/Inotify.Vue/public/favicon.ico index 46e0084f9bbbd2c669e3dbdb001c35669d5aa17a..b9ffa0137427ac9e8571388101200363d476d1e0 100644 GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#BYS4GUpRxCVe-sd}0pcA%JOPOP zfS8RKhXd8M1Mz<>_$g4V7>K!XnFEv)2jX943!MIYr)&LBZnyX!UTz3x=TEl-(@|AM z&w*+ZK<-302Ph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OV5Wf(aCKTflgKxj%A;oS5v5y)d+O5 znqs}&0eyP8El#E!=));Oy-X46Wr|QQQ;w3#{c+(PadKM<83~Nhj|8SABLgwdCy;e` zs|Z__b$qM(Qpr(!3NxIpOsBU*{)oVcfSY)k2-k;`JfQOcALHbZF1!QbdbuC+9bI_5 zj9@(h@dm3Jv<~oinUbgI0BnnsJ4n_6)*mO6sLQabUY9{ty-w~>ACG3RKP+n*443C< zh6r5x(=4n_m7*nhOw=+k7JDSYW3l6@Fn}G}^J5G|#4y5IZ17eQ>yL&LLJ{rc4Y?y4 TOq6M95BvTY8?1k{*zW%i+CoJR diff --git a/Inotify.Vue/public/index.html b/Inotify.Vue/public/index.html index fa2be91..74f6833 100644 --- a/Inotify.Vue/public/index.html +++ b/Inotify.Vue/public/index.html @@ -1,17 +1,23 @@ - - - - - - <%= webpackConfig.name %> - - - -
- - - + + + + + + <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %> + + <% } %> + + <%= webpackConfig.name %> + + + + + <% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %> + + <% } %> +
+ + + \ No newline at end of file diff --git a/Inotify.Vue/src/main.js b/Inotify.Vue/src/main.js index 4e1a5fd..0dff0ec 100644 --- a/Inotify.Vue/src/main.js +++ b/Inotify.Vue/src/main.js @@ -1,8 +1,8 @@ import Vue from 'vue' -import 'normalize.css/normalize.css' // A modern alternative to CSS resets +// import 'normalize.css/normalize.css' // A modern alternative to CSS resets import ElementUI from 'element-ui' -import 'element-ui/lib/theme-chalk/index.css' +// import 'element-ui/lib/theme-chalk/index.css' import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n import '@/styles/index.scss' // global css @@ -13,25 +13,7 @@ import router from './router' import '@/icons' // icon import '@/permission' // permission control - -/** - * If you don't want to use mock-server - * you want to use MockJs for mock api - * you can execute: mockXHR() - * - * Currently MockJs will be used in the production environment, - * please remove it before going online ! ! ! - */ -// if (process.env.NODE_ENV === 'production') { -// const { mockXHR } = require('../mock') -// mockXHR() -// } - -// set ElementUI lang to EN Vue.use(ElementUI, { locale, size: 'small' }) -// 如果想要中文版 element-ui,按如下方式声明 -// Vue.use(ElementUI) - Vue.config.productionTip = false new Vue({ diff --git a/Inotify.Vue/src/views/404.vue b/Inotify.Vue/src/views/404.vue index 1791f55..ac323e4 100644 --- a/Inotify.Vue/src/views/404.vue +++ b/Inotify.Vue/src/views/404.vue @@ -1,228 +1,45 @@ - + \ No newline at end of file diff --git a/Inotify.Vue/vue.config.js b/Inotify.Vue/vue.config.js index ea4dbd2..ee1a249 100644 --- a/Inotify.Vue/vue.config.js +++ b/Inotify.Vue/vue.config.js @@ -6,24 +6,48 @@ function resolve(dir) { return path.join(__dirname, dir) } -const name = defaultSettings.title || 'Inotify' // page title +const name = defaultSettings.title || 'Inotify' +const port = process.env.port || process.env.npm_config_port || 9528 -// If your port is set to 80, -// use administrator privileges to execute the command line. -// For example, Mac: sudo npm run -// You can change the port by the following methods: -// port = 9528 npm run dev OR npm run dev --port = 9528 -const port = process.env.port || process.env.npm_config_port || 9528 // dev port +const axiosV = require('axios/package.json').version +const echartsV = require('echarts/package.json').version +const elementV = require('element-ui/package.json').version +const jscookieV = require('js-cookie/package.json').version +const normalizeV = require('normalize.css/package.json').version +const vueV = require('vue/package.json').version +const routerV = require('vue-router/package.json').version +const vuexV = require('vuex/package.json').version +const cookieV = require('js-cookie/package.json').version +const nprogressV = require('nprogress/package.json').version +const momentV = require('moment/package.json').version +const cdn = { + externals: { + axios: 'axios', + echarts: 'echarts', + 'element-ui': 'ELEMENT', + moment: 'moment', + locale: 'locale', + vue: 'Vue', + vuex: 'Vuex', + 'vue-router': 'VueRouter' + }, + css: [`https://cdn.bootcdn.net/ajax/libs/element-ui/${elementV}/theme-chalk/index.css`, `https://cdn.bootcdn.net/ajax/libs/nprogress/${nprogressV}/nprogress.min.css`, `https://lib.baomitu.com/normalize/${normalizeV}/normalize.css`], + js: [ + `https://cdn.bootcdn.net/ajax/libs/vue/${vueV}/vue.min.js`, + `https://cdn.bootcdn.net/ajax/libs/vuex/${vuexV}/vuex.min.js`, + `https://cdn.bootcdn.net/ajax/libs/js-cookie/${jscookieV}/js.cookie.js`, + `https://cdn.bootcdn.net/ajax/libs/element-ui/${elementV}/index.js`, + `https://cdn.bootcdn.net/ajax/libs/axios/${axiosV}/axios.min.js`, + `https://cdn.bootcdn.net/ajax/libs/moment.js/${momentV}/moment.min.js`, + `https://cdn.bootcdn.net/ajax/libs/echarts/4.9.0-rc.1/echarts.min.js`, + `https://cdn.bootcdn.net/ajax/libs/vue-router/${routerV}/vue-router.min.js`, + `https://cdn.bootcdn.net/ajax/libs/element-ui/${elementV}/locale/zh-CN.js`, + `https://cdn.bootcdn.net/ajax/libs/js-cookie/${cookieV}/js.cookie.min.js`, + `https://cdn.bootcdn.net/ajax/libs/nprogress/${nprogressV}/nprogress.min.js` + ] +} -// All configuration item explanations can be find in https://cli.vuejs.org/config/ module.exports = { - /** - * You will need to set publicPath if you plan to deploy your site under a sub path, - * for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/, - * then publicPath should be set to "/bar/". - * In most cases please use '/' !!! - * Detail: https://cli.vuejs.org/config/#publicpath - */ publicPath: '/', outputDir: '../Inotify/wwwroot', assetsDir: 'static', @@ -39,9 +63,6 @@ module.exports = { before: require('./mock/mock-server.js') }, configureWebpack: { - // provide the app's title in webpack's name field, so that - // it can be accessed in index.html to inject the correct title. - name: name, resolve: { alias: { '@': resolve('src') @@ -49,19 +70,23 @@ module.exports = { }, devtool: 'source-map', performance: { - hints: 'warning', // 枚举 - hints: 'error', // 性能提示中抛出错误 - hints: false, // 关闭性能提示 - maxAssetSize: 200000, // 整数类型(以字节为单位) - maxEntrypointSize: 400000, // 整数类型(以字节为单位) + hints: 'warning', + hints: 'error', + hints: false, + maxAssetSize: 200000, + maxEntrypointSize: 400000, assetFilter: function(assetFilename) { - // 提供资源文件名的断言函数 return assetFilename.endsWith('.css') || assetFilename.endsWith('.js') } - } + }, + externals: cdn.externals }, chainWebpack(config) { - // it can improve the speed of the first screen, it is recommended to turn on preload + config.plugin('html').tap(args => { + args[0].cdn = cdn + return args + }) + config.plugin('preload').tap(() => [ { rel: 'preload', @@ -72,10 +97,7 @@ module.exports = { } ]) - // when there are many pages, it will cause too many meaningless requests config.plugins.delete('prefetch') - - // set svg-sprite-loader config.module .rule('svg') .exclude.add(resolve('src/icons'))