menu.ts
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { reactive, h } from 'vue'
import { renderIcon } from '@/utils'
import { RouterLink } from 'vue-router'
import { PageEnum } from '@/enums/pageEnum'
import { MenuOption, MenuGroupOption } from 'naive-ui'
import { icon } from '@/plugins'
const { TvOutlineIcon } = icon.ionicons5
const { DevicesIcon } = icon.carbon
export const renderMenuLabel = (option: MenuOption | MenuGroupOption) => {
return option.label
}
export const expandedKeys = () => ['three-project']
export const menuOptionsInit = () => {
const t = window['$t']
return reactive([
{
key: 'divider-1',
type: 'divider'
},
{
label: () => h('span', null, { default: () => t('project.project') }),
key: 'three-project',
icon: renderIcon(DevicesIcon),
children: [
{
type: 'group',
label: () => h('span', null, { default: () => t('project.three_project') }),
key: 'my-three-project',
children: [
{
label: () =>
h(
RouterLink,
{
to: {
name: PageEnum.THREE_HOME_ITEMS_NAME
}
},
{ default: () => t('project.all_project') }
),
key: PageEnum.THREE_HOME_ITEMS_NAME,
icon: renderIcon(TvOutlineIcon)
}
]
}
]
}
])
}