From 124778d7cfe210c4d128dbf398ddf13462653b1d Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Sun, 24 Mar 2024 18:00:15 +0800 Subject: [PATCH] [Page] [Layout] Support navigation children --- src/components/ui/collapsible/Collapsible.vue | 15 ++++++ .../ui/collapsible/CollapsibleContent.vue | 11 ++++ .../ui/collapsible/CollapsibleTrigger.vue | 11 ++++ src/components/ui/collapsible/index.ts | 3 ++ src/data/Navigation.ts | 7 ++- src/i18n/langs/en/Common.ts | 4 +- src/i18n/langs/zhCn/Common.ts | 4 +- src/model/Navigation.ts | 1 + .../components/NavigationClosed.vue | 35 +++++++++++- .../components/NavigationOpened.vue | 54 ++++++++++++++++++- .../components/NavigationRouterLink.vue | 4 +- 11 files changed, 140 insertions(+), 9 deletions(-) create mode 100644 src/components/ui/collapsible/Collapsible.vue create mode 100644 src/components/ui/collapsible/CollapsibleContent.vue create mode 100644 src/components/ui/collapsible/CollapsibleTrigger.vue create mode 100644 src/components/ui/collapsible/index.ts diff --git a/src/components/ui/collapsible/Collapsible.vue b/src/components/ui/collapsible/Collapsible.vue new file mode 100644 index 00000000..52bff5f2 --- /dev/null +++ b/src/components/ui/collapsible/Collapsible.vue @@ -0,0 +1,15 @@ + + + diff --git a/src/components/ui/collapsible/CollapsibleContent.vue b/src/components/ui/collapsible/CollapsibleContent.vue new file mode 100644 index 00000000..9f30898b --- /dev/null +++ b/src/components/ui/collapsible/CollapsibleContent.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/components/ui/collapsible/CollapsibleTrigger.vue b/src/components/ui/collapsible/CollapsibleTrigger.vue new file mode 100644 index 00000000..4a434639 --- /dev/null +++ b/src/components/ui/collapsible/CollapsibleTrigger.vue @@ -0,0 +1,11 @@ + + + diff --git a/src/components/ui/collapsible/index.ts b/src/components/ui/collapsible/index.ts new file mode 100644 index 00000000..4930f4c6 --- /dev/null +++ b/src/components/ui/collapsible/index.ts @@ -0,0 +1,3 @@ +export { default as Collapsible } from './Collapsible.vue' +export { default as CollapsibleTrigger } from './CollapsibleTrigger.vue' +export { default as CollapsibleContent } from './CollapsibleContent.vue' diff --git a/src/data/Navigation.ts b/src/data/Navigation.ts index 086d618e..b0c7ff80 100644 --- a/src/data/Navigation.ts +++ b/src/data/Navigation.ts @@ -1,6 +1,6 @@ import { NavigationModel, NavigationPosition } from '@/model/Navigation' import NavigationService from '@/services/Navigation' -import { Home, LogIn, LogOut } from 'lucide-vue-next' +import { Ban, Home, LogIn, LogOut, StickyNote } from 'lucide-vue-next' const createNavigation = (): void => { NavigationService.addNavigation(createNavigationItem('common.common.home', undefined, '/home', Home, NavigationPosition.LEFT_TOP)) @@ -34,6 +34,11 @@ const createNavigation = (): void => { [datacap], 'common.common.openProject') NavigationService.addNavigation(openProject) + + const page404 = createNavigationItem('common.common.page404', undefined, '/common/404', Ban, NavigationPosition.LEFT_TOP) + const pages = createNavigationItem('common.common.page', undefined, '/pages', StickyNote, + NavigationPosition.LEFT_TOP, [page404], undefined, 'common.common.page') + NavigationService.addNavigation(pages) } const createNavigationItem = (title?: string, label?: string, href?: string, icon?: any, position?: NavigationPosition, children?: NavigationModel[], group?: string, description?: string, blank?: boolean): NavigationModel => { diff --git a/src/i18n/langs/en/Common.ts b/src/i18n/langs/en/Common.ts index 9d244a18..e9c2505e 100644 --- a/src/i18n/langs/en/Common.ts +++ b/src/i18n/langs/en/Common.ts @@ -12,7 +12,9 @@ export default { logout: 'Logout', codeMirror: 'Code Mirror', openProject: 'Open Project', - datacap: 'DataCap' + datacap: 'DataCap', + page: 'Page', + page404: '404' }, tip: { signInInfo: 'Enter your information to sign in to your account.', diff --git a/src/i18n/langs/zhCn/Common.ts b/src/i18n/langs/zhCn/Common.ts index 52c23293..598d1ca6 100644 --- a/src/i18n/langs/zhCn/Common.ts +++ b/src/i18n/langs/zhCn/Common.ts @@ -12,7 +12,9 @@ export default { logout: '退出', codeMirror: '代码仓库', openProject: '开源项目', - datacap: 'DataCap' + datacap: 'DataCap', + page: '页面', + page404: '404' }, tip: { signInInfo: '输入您的信息以登录您的帐户。', diff --git a/src/model/Navigation.ts b/src/model/Navigation.ts index e7659b81..57da4f00 100644 --- a/src/model/Navigation.ts +++ b/src/model/Navigation.ts @@ -7,6 +7,7 @@ export interface NavigationModel group?: string description?: string, external?: boolean + opened?: boolean position?: NavigationPosition children?: NavigationModel[] } diff --git a/src/views/layouts/base/components/components/NavigationClosed.vue b/src/views/layouts/base/components/components/NavigationClosed.vue index a9fae7d1..9b5a1569 100644 --- a/src/views/layouts/base/components/components/NavigationClosed.vue +++ b/src/views/layouts/base/components/components/NavigationClosed.vue @@ -1,6 +1,30 @@