ant-design-vue/components/dropdown/demo/overlay-visible.md

40 lines
932 B
Markdown
Raw Normal View History

2018-01-29 10:57:20 +00:00
<cn>
#### 菜单隐藏方式
默认是点击关闭菜单,可以关闭此功能。
</cn>
<us>
#### The way of hiding menu.
The default is to close the menu when you click on menu items, this feature can be turned off.
</us>
2019-10-09 10:32:23 +00:00
```tpl
2018-01-29 10:57:20 +00:00
<template>
<a-dropdown v-model="visible">
2019-09-28 12:45:07 +00:00
<a class="ant-dropdown-link" href="#"> Hover me <a-icon type="down" /> </a>
2018-01-29 10:57:20 +00:00
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="1">Clicking me will not close the menu.</a-menu-item>
<a-menu-item key="2">Clicking me will not close the menu also.</a-menu-item>
<a-menu-item key="3">Clicking me will close the menu</a-menu-item>
</a-menu>
</a-dropdown>
</template>
<script>
2019-09-28 12:45:07 +00:00
export default {
data() {
return {
visible: false,
};
2018-01-29 10:57:20 +00:00
},
2019-09-28 12:45:07 +00:00
methods: {
handleMenuClick(e) {
if (e.key === '3') {
this.visible = false;
}
},
},
};
2018-01-29 10:57:20 +00:00
</script>
```