From f83cfaba0d28308a99cc5ea4f3ac705bf810320e Mon Sep 17 00:00:00 2001 From: qxz Date: Thu, 7 May 2020 14:54:04 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=BC=98=E5=8C=96=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 92 ++++++++++++++++++++----------------- src/i18n.js | 2 +- src/router/index.js | 2 +- src/router/routes.js | 52 ++++++++++++++++++--- src/views/Layout.vue | 4 +- src/views/common/Navbar.vue | 6 +-- src/views/page/GoImg.vue | 7 ++- src/views/page/GoList.vue | 47 +++++++++++-------- src/views/page/GoPdf.vue | 5 +- src/views/page/GoText.vue | 20 +++++--- src/views/page/GoVideo.vue | 15 +++--- 11 files changed, 163 insertions(+), 89 deletions(-) diff --git a/public/index.html b/public/index.html index 826b528..1b2ccea 100644 --- a/public/index.html +++ b/public/index.html @@ -1,45 +1,53 @@ - - - - - - - <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %> - - - <% } %> - <%= htmlWebpackPlugin.options.title %> - - - <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %> - - <% } %> - - - - - - + + + + + + + <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.css) { %> + + + <% } %> + <%= htmlWebpackPlugin.options.title %> + + + <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %> + + <% } %> + + + + + + + + \ No newline at end of file diff --git a/src/i18n.js b/src/i18n.js index 386a7d4..966a37b 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -25,7 +25,7 @@ Vue.prototype.$languages = Object.keys(messages).map(langlage => ({ })) export default new VueI18n({ - locale: util.cookies.get('lang') || process.env.VUE_APP_I18N_LOCALE, + locale: util.cookies.get('lang') || window.gdconfig.themeOptions.languages || process.env.VUE_APP_I18N_LOCALE, fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE, messages }) \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 5ae3c47..979b5d8 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -30,7 +30,7 @@ const router = new VueRouter({ */ router.beforeEach(async (to, from, next) => { console.log("before:"); - console.log(to); + console.log(to,from); next(); }); diff --git a/src/router/routes.js b/src/router/routes.js index ee69890..0d350b7 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -1,12 +1,50 @@ // 由于懒加载页面太多的话会造成webpack热更新太慢,所以开发环境不使用懒加载,只有生产环境使用懒加载 const _import = require("@/libs/util.import." + process.env.NODE_ENV); -const frameIn = [ - { path: "/:id:(text)/:path", component: _import("page/GoText"), props: true }, - { path: "/:id:(pdf)/:path", component: _import("page/GoPdf"), props: true }, - { path: "/:id:(video)/:path", component: _import("page/GoVideo") }, - { path: "/:id:(image)/:path", component: _import("page/GoImg") }, - { path: "/:id::cmd?(/?/??.*/)", component: _import("page/GoList") }, +const meta = { + keepAlive: true +} + +const frameIn = [{ + path: "/:id:(text)/:path", + component: _import("page/GoText"), + meta: { + ...meta, + view: 'text' + } + }, + { + path: "/:id:(pdf)/:path", + component: _import("page/GoPdf"), + meta: { + ...meta, + view: 'pdf' + } + }, + { + path: "/:id:(video)/:path", + component: _import("page/GoVideo"), + meta: { + ...meta, + view: 'video' + } + }, + { + path: "/:id:(image)/:path", + component: _import("page/GoImg"), + meta: { + ...meta, + view: 'image' + } + }, + { + path: "/:id::cmd?(/?/??.*)", + component: _import("page/GoList"), + meta: { + ...meta, + view: 'list' + } + }, ]; -export default frameIn; +export default frameIn; \ No newline at end of file diff --git a/src/views/Layout.vue b/src/views/Layout.vue index c54e5ea..3a36d0e 100644 --- a/src/views/Layout.vue +++ b/src/views/Layout.vue @@ -4,9 +4,9 @@
- + - +
diff --git a/src/views/common/Navbar.vue b/src/views/common/Navbar.vue index e1c3202..fcac841 100644 --- a/src/views/common/Navbar.vue +++ b/src/views/common/Navbar.vue @@ -38,7 +38,7 @@ +