import './index.scss' import { NMenu, NLayoutSider, NEllipsis } from 'naive-ui' import RayIcon from '@/components/RayIcon/index' import { useMenu } from '@/store' import { APP_MENU_CONFIG } from '@/appConfig/appConfig' import { useVueRouter } from '@/router/helper/useVueRouter' import type { MenuInst } from 'naive-ui' import type { NaiveMenuOptions } from '@/types/modules/component' const LayoutMenu = defineComponent({ name: 'LayoutMenu', setup() { const menuRef = ref(null) const menuStore = useMenu() const { router } = useVueRouter() const { changeMenuModelValue, collapsedMenu } = menuStore const modelMenuKey = computed({ get: () => { nextTick().then(() => { showMenuOption() }) return menuStore.menuKey }, // eslint-disable-next-line @typescript-eslint/no-empty-function set: () => {}, }) const modelMenuOptions = computed(() => menuStore.options) const modelCollapsed = computed(() => menuStore.collapsed) const { layout: { sideBarLogo }, } = __APP_CFG__ const handleSideBarLogoClick = () => { if (sideBarLogo && sideBarLogo.url) { sideBarLogo.jumpType === 'station' ? router.push(sideBarLogo.url) : window.open(sideBarLogo.url) } } const showMenuOption = () => { const key = modelMenuKey.value as string nextTick().then(() => { menuRef.value?.showOption?.(key) }) } return { modelMenuKey, changeMenuModelValue, modelMenuOptions, modelCollapsed, collapsedMenu, sideBarLogo, handleSideBarLogoClick, menuRef, } }, render() { return ( {this.sideBarLogo ? (
{this.sideBarLogo.icon ? ( ) : ( '' )}

{this.sideBarLogo.title}

) : ( '' )}
) }, }) export default LayoutMenu