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 46e0084..b9ffa01 100644 Binary files a/Inotify.Vue/public/favicon.ico and b/Inotify.Vue/public/favicon.ico differ 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'))