提交 | 用户 | 时间
|
314507
|
1 |
import type { RouteMeta } from 'vue-router' |
H |
2 |
import { Icon } from '@/components/Icon' |
|
3 |
import { useI18n } from '@/hooks/web/useI18n' |
|
4 |
|
|
5 |
export const useRenderMenuTitle = () => { |
|
6 |
const renderMenuTitle = (meta: RouteMeta) => { |
|
7 |
const { t } = useI18n() |
|
8 |
const { title = 'Please set title', icon } = meta |
|
9 |
|
|
10 |
return icon ? ( |
|
11 |
<> |
|
12 |
<Icon icon={meta.icon}></Icon> |
|
13 |
<span class="v-menu__title overflow-hidden overflow-ellipsis whitespace-nowrap"> |
|
14 |
{t(title as string)} |
|
15 |
</span> |
|
16 |
</> |
|
17 |
) : ( |
|
18 |
<span class="v-menu__title overflow-hidden overflow-ellipsis whitespace-nowrap"> |
|
19 |
{t(title as string)} |
|
20 |
</span> |
|
21 |
) |
|
22 |
} |
|
23 |
|
|
24 |
return { |
|
25 |
renderMenuTitle |
|
26 |
} |
|
27 |
} |