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