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

45 lines
1.1 KiB
Markdown
Raw Normal View History

2019-11-27 17:01:21 +08:00
# Basic
```html
<div>
<n-menu
2019-11-27 17:01:21 +08:00
v-model="selected"
@openNamesChange="changeOpen"
@select="changeSelect"
2020-01-13 23:06:58 +08:00
>
2019-11-27 17:01:21 +08:00
<n-menu-item title="num1" name="num1"></n-menu-item>
<n-menu-item title="num2" name="num2"></n-menu-item>
<n-menu-item title="num3" name="num3"></n-menu-item>
<n-submenu title="subMenu" name="subMenu">
2019-11-27 17:01:21 +08:00
<n-menu-item title="sub1" name="sub1"></n-menu-item>
</n-submenu>
<n-submenu title="subMenu2" name="subMenu2">
<n-submenu title="subMenu22" name="subMenu22">
<n-menu-item title="sub222" name="sub222"></n-menu-item>
</n-submenu>
</n-submenu>
<n-submenu title="subMenu3" name="subMenu3">
2020-01-15 13:00:43 +08:00
<n-menu-item title="sub1" name="sub8"></n-menu-item>
<n-menu-item title="sub1" name="sub6"></n-menu-item>
<n-menu-item title="sub1" name="sub7"></n-menu-item>
</n-submenu>
2019-11-27 17:01:21 +08:00
</n-menu>
</div>
```
```js
export default {
data () {
return {
selected: 'sub1',
}
},
methods: {
changeOpen (names) {
console.log('names', names)
},
changeSelect (val) {
console.log('changeSelect', val)
}
}
};
```