-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
"filemanager", | ||
"Hengyang", | ||
"Kanban", | ||
"Openeds", | ||
"Popconfirm", | ||
"Qihu", | ||
"sheepzh", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,73 @@ | ||
import { InfoFilled } from "@element-plus/icons-vue" | ||
import { ElBreadcrumb, ElDropdown, ElDropdownMenu, ElIcon } from "element-plus" | ||
import { defineComponent } from "vue" | ||
|
||
const _default = defineComponent({ | ||
setup() { | ||
return () => ( | ||
<div class="nav-container"> | ||
<ElBreadcrumb /> | ||
<ElDropdown v-slots={{ | ||
default: () => ( | ||
<ElIcon> | ||
<InfoFilled /> | ||
</ElIcon> | ||
), | ||
dropdown: () => ( | ||
<ElDropdownMenu> | ||
|
||
</ElDropdownMenu> | ||
) | ||
}}> | ||
</ElDropdown> | ||
</div> | ||
) | ||
/** | ||
* Copyright (c) 2024-present Hengyang Zhang | ||
* | ||
* This software is released under the MIT License. | ||
* https://opensource.org/licenses/MIT | ||
*/ | ||
|
||
import { CloseBold, Menu } from "@element-plus/icons-vue" | ||
import { ElBreadcrumb, ElBreadcrumbItem, ElIcon, ElMenu, ElMenuItem, ElMenuItemGroup, ElSubMenu } from "element-plus" | ||
import { defineComponent, onMounted, ref, watch } from "vue" | ||
import { useRouter } from "vue-router" | ||
import { initTitle } from "./route" | ||
import { MENUS } from "./item" | ||
import { t } from "@app/locale" | ||
import { classNames } from "@util/style" | ||
|
||
const findMenuPath = (routePath: string): string[] => { | ||
return ['hahaah', 'aaas'] | ||
} | ||
|
||
const _default = defineComponent(() => { | ||
const router = useRouter() | ||
const path = ref<string[]>([]) | ||
const showMenu = ref(false) | ||
const openedGroups = ref(MENUS.map(m => m.index)) | ||
|
||
const syncRouter = () => { | ||
const route = router.currentRoute.value | ||
route && (path.value = findMenuPath(route.path)) | ||
} | ||
|
||
watch(router.currentRoute, syncRouter) | ||
|
||
onMounted(() => initTitle(router)) | ||
|
||
return () => ( | ||
<div class={classNames("nav-container", showMenu.value ? 'open' : 'close')}> | ||
<div class="nav-content"> | ||
<ElBreadcrumb separator="/"> | ||
{path.value?.map(p => <ElBreadcrumbItem>{p}</ElBreadcrumbItem>)} | ||
</ElBreadcrumb> | ||
<div onClick={() => showMenu.value = !showMenu.value}> | ||
<ElIcon size="large"> | ||
{showMenu.value ? <CloseBold /> : <Menu />} | ||
</ElIcon> | ||
</div> | ||
</div> | ||
<div class={classNames("menu-wrapper", showMenu.value ? 'open' : 'close')}> | ||
<ElMenu | ||
defaultOpeneds={openedGroups.value} | ||
onOpen={index => openedGroups.value = [...openedGroups.value || [], index]} | ||
onClose={index => openedGroups.value = openedGroups.value?.filter(v => v !== index)} | ||
> | ||
{MENUS.map(({ title, children }, idx) => ( | ||
<ElSubMenu | ||
index={`sub-${idx}`} | ||
v-slots={{ | ||
title: () => t(title), | ||
default: () => children?.map(item => <ElMenuItem> | ||
{ | ||
t(item.title) | ||
} | ||
</ElMenuItem>) | ||
}} | ||
/> | ||
))} | ||
</ElMenu> | ||
</div> | ||
</div> | ||
) | ||
}) | ||
|
||
export default _default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters