Download packages/effects/layouts/src/basic/menu/mixed-menu.vue from binhugg3/admin: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/spaces/binhugg3/admin/resolve/main/packages/effects/layouts/src/basic/menu/mixed-menu.vue
- Command line
-
hf download hf://spaces/binhugg3/admin/packages/effects/layouts/src/basic/menu/mixed-menu.vue
-
curl -L -o mixed-menu.vue https://huggingface.co/spaces/binhugg3/admin/resolve/main/packages/effects/layouts/src/basic/menu/mixed-menu.vue
1.06 kB
| <script lang="ts" setup> | |
| import type { MenuRecordRaw } from '@vben/types'; | |
| import type { NormalMenuProps } from '@vben-core/menu-ui'; | |
| import { onBeforeMount } from 'vue'; | |
| import { useRoute } from 'vue-router'; | |
| import { findMenuByPath } from '@vben/utils'; | |
| import { NormalMenu } from '@vben-core/menu-ui'; | |
| interface Props extends NormalMenuProps {} | |
| const props = defineProps<Props>(); | |
| const emit = defineEmits<{ | |
| defaultSelect: [MenuRecordRaw, MenuRecordRaw?]; | |
| enter: [MenuRecordRaw]; | |
| select: [MenuRecordRaw]; | |
| }>(); | |
| const route = useRoute(); | |
| onBeforeMount(() => { | |
| const menu = findMenuByPath(props.menus || [], route.path); | |
| if (menu) { | |
| const rootMenu = (props.menus || []).find( | |
| (item) => item.path === menu.parents?.[0], | |
| ); | |
| emit('defaultSelect', menu, rootMenu); | |
| } | |
| }); | |
| </script> | |
| <template> | |
| <NormalMenu | |
| :active-path="activePath" | |
| :collapse="collapse" | |
| :menus="menus" | |
| :rounded="rounded" | |
| :theme="theme" | |
| @enter="(menu) => emit('enter', menu)" | |
| @select="(menu) => emit('select', menu)" | |
| /> | |
| </template> | |