ant-design-vue/components/dropdown/demo/dropdown-button.md

54 lines
1.7 KiB
Markdown
Raw Normal View History

2018-01-29 10:57:20 +00:00
<cn>
#### 带下拉框的按钮
左边是按钮,右边是额外的相关功能菜单。
</cn>
<us>
#### Button with dropdown menu
A button is on the left, and a related functional menu is on the right.
</us>
2019-10-09 10:32:23 +00:00
```tpl
2018-01-29 10:57:20 +00:00
<template>
2019-09-28 12:45:07 +00:00
<div>
<a-dropdown-button @click="handleButtonClick">
Dropdown
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="1"><a-icon type="user" />1st menu item</a-menu-item>
<a-menu-item key="2"><a-icon type="user" />2nd menu item</a-menu-item>
<a-menu-item key="3"><a-icon type="user" />3rd item</a-menu-item>
</a-menu>
</a-dropdown-button>
<a-dropdown-button @click="handleButtonClick" disabled style="margin-left: 8px">
Dropdown
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="1"><a-icon type="user" />1st menu item</a-menu-item>
<a-menu-item key="2"><a-icon type="user" />2nd menu item</a-menu-item>
<a-menu-item key="3"><a-icon type="user" />3rd item</a-menu-item>
</a-menu>
</a-dropdown-button>
<a-dropdown>
<a-menu slot="overlay" @click="handleMenuClick">
<a-menu-item key="1"><a-icon type="user" />1st menu item</a-menu-item>
<a-menu-item key="2"><a-icon type="user" />2nd menu item</a-menu-item>
<a-menu-item key="3"><a-icon type="user" />3rd item</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> Button <a-icon type="down" /> </a-button>
</a-dropdown>
</div>
2018-01-29 10:57:20 +00:00
</template>
<script>
2019-09-28 12:45:07 +00:00
export default {
methods: {
handleButtonClick(e) {
console.log('click left button', e);
},
handleMenuClick(e) {
console.log('click', e);
},
2018-01-29 10:57:20 +00:00
},
2019-09-28 12:45:07 +00:00
};
2018-01-29 10:57:20 +00:00
</script>
```