From 4857bd7ac153a88dece19709274490adca2881ff Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Sat, 24 Oct 2020 17:07:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B5=E9=9D=A2=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD=E3=80=81=E8=B0=83=E6=95=B4=E7=A9=BA?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ThemeSetting/index.vue | 3 +- src/layout/empty.vue | 16 ++++++++ src/layout/index.vue | 15 ++++++-- src/layout/keepAlive.vue | 37 ------------------- src/router/index.js | 4 +- src/router/modules/breadcrumb.example.js | 4 +- src/router/modules/keep.alive.example.js | 6 +-- src/router/modules/multilevel.menu.example.js | 6 +-- 8 files changed, 39 insertions(+), 52 deletions(-) create mode 100644 src/layout/empty.vue delete mode 100644 src/layout/keepAlive.vue diff --git a/src/components/ThemeSetting/index.vue b/src/components/ThemeSetting/index.vue index 89b00edf..59d1d321 100644 --- a/src/components/ThemeSetting/index.vue +++ b/src/components/ThemeSetting/index.vue @@ -41,8 +41,7 @@ 开启 关闭 - - + diff --git a/src/layout/empty.vue b/src/layout/empty.vue new file mode 100644 index 00000000..a44f915b --- /dev/null +++ b/src/layout/empty.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/layout/index.vue b/src/layout/index.vue index 88b98f3a..4fbeed50 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -88,7 +88,7 @@
- +
@@ -106,6 +106,7 @@ import variables from '@/assets/styles/resources/variables.scss' export default { + inject: ['reload'], name: 'Layout', data() { return { @@ -144,8 +145,16 @@ export default { }, mounted() { this.$hotkeys('alt+s', e => { - e.preventDefault() - this.$store.commit('global/toggleSearch') + if (this.$store.state.global.enableNavSearch) { + e.preventDefault() + this.$store.commit('global/toggleSearch') + } + }) + this.$hotkeys('f5', e => { + if (this.$store.state.global.enablePageReload) { + e.preventDefault() + this.reload(2) + } }) window.addEventListener('scroll', this.onScroll) }, diff --git a/src/layout/keepAlive.vue b/src/layout/keepAlive.vue deleted file mode 100644 index e4b27e6e..00000000 --- a/src/layout/keepAlive.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/src/router/index.js b/src/router/index.js index 6b0a9835..4fce2c44 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,7 +7,7 @@ import 'nprogress/nprogress.css' // progress bar style Vue.use(Router) import Layout from '@/layout' -import KeepAliveLayout from '@/layout/keepAlive' +import EmptyLayout from '@/layout/empty' const constantRoutes = [ { @@ -33,7 +33,7 @@ const constantRoutes = [ }, { path: 'personal', - component: KeepAliveLayout, + component: EmptyLayout, redirect: '/personal/setting', meta: { title: '个人中心', diff --git a/src/router/modules/breadcrumb.example.js b/src/router/modules/breadcrumb.example.js index 1d75be4f..de44e80a 100644 --- a/src/router/modules/breadcrumb.example.js +++ b/src/router/modules/breadcrumb.example.js @@ -1,5 +1,5 @@ import Layout from '@/layout' -import KeepAliveLayout from '@/layout/keepAlive' +import EmptyLayout from '@/layout/empty' export default { path: '/breadcrumb_example', @@ -32,7 +32,7 @@ export default { { path: 'list2', name: 'breadcrumbExampleList2', - component: KeepAliveLayout, + component: EmptyLayout, redirect: '/breadcrumb_example/list2', meta: { title: '列表2(层级模式)' diff --git a/src/router/modules/keep.alive.example.js b/src/router/modules/keep.alive.example.js index ffa687bc..289d6b7d 100644 --- a/src/router/modules/keep.alive.example.js +++ b/src/router/modules/keep.alive.example.js @@ -1,5 +1,5 @@ import Layout from '@/layout' -import KeepAliveLayout from '@/layout/keepAlive' +import EmptyLayout from '@/layout/empty' export default { path: '/keep_alive_example', @@ -33,7 +33,7 @@ export default { }, { path: 'detail2', - component: KeepAliveLayout, + component: EmptyLayout, redirect: '/keep_alive_example/detail2', meta: { title: '下级路由', @@ -51,7 +51,7 @@ export default { }, { path: 'detail3', - component: KeepAliveLayout, + component: EmptyLayout, redirect: '/keep_alive_example/detail2/detail3', meta: { title: '下下级路由', diff --git a/src/router/modules/multilevel.menu.example.js b/src/router/modules/multilevel.menu.example.js index ecca7b0a..64d88008 100644 --- a/src/router/modules/multilevel.menu.example.js +++ b/src/router/modules/multilevel.menu.example.js @@ -1,5 +1,5 @@ import Layout from '@/layout' -import KeepAliveLayout from '@/layout/keepAlive' +import EmptyLayout from '@/layout/empty' export default { path: '/multilevel_menu_example', @@ -22,7 +22,7 @@ export default { { path: 'level2', name: 'multilevelMenuExample2', - component: KeepAliveLayout, + component: EmptyLayout, redirect: '/multilevel_menu_example/level2/page', meta: { title: '导航2' @@ -39,7 +39,7 @@ export default { { path: 'level3', name: 'multilevelMenuExample2-2', - component: KeepAliveLayout, + component: EmptyLayout, redirect: '/multilevel_menu_example/level2/level3/page1', meta: { title: '导航2-2'