mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-24 12:45:18 +08:00
6453b90043
* feat(vite-doc): add vite md plugin * fixed(site-vite): merge conflicts * fix(vite-doc): some bug in vue rerender,use key to advoid * feat(vite-doc): finished doc * fix(vite-doc): import path should be same as normal * chore(vite-doc): remove useless code Co-authored-by: Lecong Zhang <50313260+tskirby@users.noreply.github.com>
2.1 KiB
2.1 KiB
Horizontal
A horiziontal menu.
<n-menu
v-model="activeName"
mode="horizontal"
:items="menuItems"
/>
<n-menu
v-model:value="activeKey"
mode="horizontal"
:items="menuItems"
/>
import { h, resolveComponent } from 'vue'
import bookIcon from 'naive-ui/lib/icons/book-outline.vue'
import personIcon from 'naive-ui/lib/icons/person-outline.vue'
import wineIcon from 'naive-ui/lib/icons/wine-outline.vue'
function renderIcon(icon) {
return () => h(resolveComponent('n-icon'), null, { default: () => h(icon) })
}
const menuItems = [
{
title: 'Hear the Wind Sing',
key: 'hear-the-wind-sing',
icon: renderIcon(bookIcon)
},
{
title: 'Pinball 1973',
key: 'pinball-1973',
icon: renderIcon(bookIcon),
disabled: true,
children: [
{
title: 'Rat',
key: 'rat'
}
]
},
{
title: 'A Wild Sheep Chase',
key: 'a-wild-sheep-chase',
disabled: true,
icon: renderIcon(bookIcon)
},
{
title: '舞,舞,舞',
key: 'Dance Dance Dance',
icon: renderIcon(bookIcon),
children: [
{
type: 'group',
title: 'People',
key: 'people',
children: [
{
title: 'Narrator',
key: 'narrator',
icon: renderIcon(personIcon)
},
{
title: 'Sheep Man',
key: 'sheep-man',
icon: renderIcon(personIcon)
}
]
},
{
title: 'Beverage',
key: 'beverage',
icon: renderIcon(wineIcon),
children: [
{
title: 'Whisky',
key: 'whisky'
}
]
},
{
title: 'Food',
key: 'food',
children: [
{
title: 'Sandwich',
key: 'sandwich'
}
]
},
{
title: 'The past increases. The future recedes.',
key: 'the-past-increases-the-future-recedes'
}
]
}
]
export default {
data () {
return {
activeKey: null,
menuItems
}
}
}
.n-menu-item {
padding-right: 16px;
}