naive-ui/demo/documentation/components/menu/enUS/items.md

96 lines
1.7 KiB
Markdown
Raw Normal View History

2019-11-27 17:01:21 +08:00
# items
```html
<n-menu
2019-11-27 17:01:21 +08:00
v-model="selected"
:items="items"
@select="changeSelect"
@openNamesChange="changeOpen"
2019-11-27 17:01:21 +08:00
>
</n-menu>
```
```js
export default {
data () {
return {
selected: 'sub1',
items: [
{
title: 'num1',
name: 'num1',
},
{
title: 'num2',
name: 'num2',
},
{
title: 'num3',
name: 'num3',
2019-11-27 17:01:21 +08:00
},
{
title: 'subMenu',
name: 'subMenu',
children: [
{
title:'sub1',
name: 'sub1',
2019-12-31 18:22:45 +08:00
group: true,
2019-11-27 17:01:21 +08:00
children: [
{
title: 'subsub001',
name: 'subsub001'
},
]
}
]
},
{
title: 'subMenu2',
name: 'subMenu2',
children: [
{
2019-12-31 18:22:45 +08:00
group: true,
title:'sub2',
name: 'sub2',
children: [
2019-11-27 17:01:21 +08:00
{
title: 'subsub002',
name: 'subsub002'
},
]
}
]
},
{
title: 'subMenu3',
name: 'subMenu3',
children: [
{
2019-12-31 18:22:45 +08:00
group: true,
title:'sub3',
name: 'sub3',
children: [
{
title: 'subsub003',
name: 'subsub003'
},
2019-11-27 17:01:21 +08:00
]
}
]
}
]
}
},
methods: {
changeSelect (val) {
console.log('changeSelect', val)
},
changeOpen (val) {
console.log('changeOpen', val)
this.opens = val
2019-11-27 17:01:21 +08:00
}
}
};
```
```css
```