From 8b63bb71ccf1bdc4f4871cc096bfcb8a48871fc3 Mon Sep 17 00:00:00 2001 From: Frost-ZX Date: Wed, 28 Aug 2024 13:01:50 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B7=BB=E5=8A=A0=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/modules.js | 10 ++++++++++ src/router/index.js | 17 +++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 src/config/modules.js diff --git a/src/config/modules.js b/src/config/modules.js new file mode 100644 index 0000000..71f5451 --- /dev/null +++ b/src/config/modules.js @@ -0,0 +1,10 @@ +import { IS_DEV } from './env'; + +/** 启用“导航”模块 */ +export const ENABLE_NAV_MODULE = IS_DEV; + +/** 启用“搜索”模块 */ +export const ENABLE_SEARCH_MODULE = IS_DEV; + +/** 启用“工具箱”模块 */ +export const ENABLE_TOOLBOX_MODULE = IS_DEV; diff --git a/src/router/index.js b/src/router/index.js index fc8db9c..0b369a4 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -1,4 +1,13 @@ -import { createRouter, createWebHashHistory } from 'vue-router'; +import { + createRouter, + createWebHashHistory, +} from 'vue-router'; + +import { + ENABLE_SEARCH_MODULE, + ENABLE_NAV_MODULE, + ENABLE_TOOLBOX_MODULE, +} from '@/config/modules'; import AboutView from '@/views/AboutView/AboutView.vue'; import IndexView from '@/views/IndexView/IndexView.vue'; @@ -22,7 +31,7 @@ export const router = createRouter({ component: () => import('@/views/SearchView/SearchView.vue'), meta: { iconClass: 'mdi mdi-magnify', - showInAside: true, + showInAside: ENABLE_SEARCH_MODULE, title: '搜索', }, }, @@ -32,7 +41,7 @@ export const router = createRouter({ component: () => import('@/views/NavView/NavView.vue'), meta: { iconClass: 'mdi mdi-compass-outline', - showInAside: true, + showInAside: ENABLE_NAV_MODULE, title: '导航', }, }, @@ -42,7 +51,7 @@ export const router = createRouter({ component: () => import('@/views/ToolboxView/ToolboxView.vue'), meta: { iconClass: 'mdi mdi-tools', - showInAside: true, + showInAside: ENABLE_TOOLBOX_MODULE, title: '工具箱', }, },