2019-12-03 18:36:21 +08:00
|
|
|
# Trigger
|
2020-01-27 17:09:09 +08:00
|
|
|
Different trigger of dropdown.
|
2019-10-22 13:48:51 +08:00
|
|
|
```html
|
2020-01-27 17:09:09 +08:00
|
|
|
<n-dropdown @select="handleSelect" trigger="hover" :options="options">
|
2020-02-04 22:07:55 +08:00
|
|
|
<n-button>Hover!</n-button>
|
2019-10-22 13:48:51 +08:00
|
|
|
</n-dropdown>
|
2019-12-02 20:57:09 +08:00
|
|
|
|
2020-01-27 17:09:09 +08:00
|
|
|
<n-dropdown @select="handleSelect" trigger="click" :focusable="false" :options="options">
|
2020-02-04 22:07:55 +08:00
|
|
|
<n-button>Click!</n-button>
|
2019-10-22 13:48:51 +08:00
|
|
|
</n-dropdown>
|
2019-12-03 18:36:21 +08:00
|
|
|
|
2020-01-27 17:09:09 +08:00
|
|
|
<n-dropdown @select="handleSelect" trigger="manual" :show="showDropdown" :options="options">
|
|
|
|
<n-button @click="handleClick">Oh! Manually By Myself!</n-button>
|
2019-12-03 18:36:21 +08:00
|
|
|
</n-dropdown>
|
2019-10-22 13:48:51 +08:00
|
|
|
```
|
|
|
|
```js
|
|
|
|
export default {
|
|
|
|
data () {
|
|
|
|
return {
|
2020-01-27 17:09:09 +08:00
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'Marina Bay Sands',
|
|
|
|
key: 'Marina Bay Sands'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Brown\'s Hotel, London',
|
|
|
|
key: 'Brown\'s Hotel, London'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Atlantis Bahamas, Nassau',
|
|
|
|
key: 'Atlantis Bahamas, Nassau'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'The Beverly Hills Hotel, Los Angeles',
|
|
|
|
key: 'The Beverly Hills Hotel, Los Angeles'
|
|
|
|
}
|
2019-12-03 18:36:21 +08:00
|
|
|
],
|
|
|
|
showDropdown: false
|
2019-10-22 13:48:51 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2019-12-02 20:57:09 +08:00
|
|
|
handleSelect (name) {
|
|
|
|
this.$NMessage.info(name)
|
2019-12-03 18:36:21 +08:00
|
|
|
},
|
|
|
|
handleClick () {
|
|
|
|
this.showDropdown = !this.showDropdown
|
2019-10-22 13:48:51 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-02 20:57:09 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
```css
|
|
|
|
.n-button {
|
|
|
|
margin: 0 8px 12px 0;
|
|
|
|
}
|
2019-10-22 13:48:51 +08:00
|
|
|
```
|