2019-12-03 18:36:21 +08:00
|
|
|
|
# Trigger
|
2019-10-22 13:48:51 +08:00
|
|
|
|
```html
|
2019-12-02 20:57:09 +08:00
|
|
|
|
<n-dropdown @select="handleSelect" trigger="hover">
|
2019-10-22 13:48:51 +08:00
|
|
|
|
<template v-slot:activator>
|
2019-12-03 21:48:34 +08:00
|
|
|
|
<n-button>Hover! On the Green Light!</n-button>
|
2019-10-22 13:48:51 +08:00
|
|
|
|
</template>
|
|
|
|
|
<n-dropdown-item
|
2019-12-02 20:57:09 +08:00
|
|
|
|
v-for="hotel in hotels"
|
|
|
|
|
:key="hotel"
|
|
|
|
|
:name="hotel.toLowerCase()"
|
2019-12-03 20:00:29 +08:00
|
|
|
|
:label="hotel"
|
|
|
|
|
/>
|
2019-10-22 13:48:51 +08:00
|
|
|
|
</n-dropdown>
|
2019-12-02 20:57:09 +08:00
|
|
|
|
|
2019-12-03 18:36:21 +08:00
|
|
|
|
<n-dropdown @select="handleSelect" trigger="click" :focusable="false">
|
2019-10-22 13:48:51 +08:00
|
|
|
|
<template v-slot:activator>
|
2019-12-03 21:48:34 +08:00
|
|
|
|
<n-button>Click! On the Green Light</n-button>
|
2019-10-22 13:48:51 +08:00
|
|
|
|
</template>
|
|
|
|
|
<n-dropdown-item
|
2019-12-02 20:57:09 +08:00
|
|
|
|
v-for="hotel in hotels"
|
|
|
|
|
:key="hotel"
|
|
|
|
|
:name="hotel.toLowerCase()"
|
2019-12-03 20:00:29 +08:00
|
|
|
|
:label="hotel"
|
|
|
|
|
/>
|
2019-10-22 13:48:51 +08:00
|
|
|
|
</n-dropdown>
|
2019-12-03 18:36:21 +08:00
|
|
|
|
|
|
|
|
|
<n-dropdown @select="handleSelect" trigger="manual" v-model="showDropdown">
|
|
|
|
|
<template v-slot:activator>
|
2019-12-03 21:48:34 +08:00
|
|
|
|
<n-button @click="handleClick">Oh! Manually By Myself!</n-button>
|
2019-12-03 18:36:21 +08:00
|
|
|
|
</template>
|
|
|
|
|
<n-dropdown-item
|
|
|
|
|
v-for="hotel in hotels"
|
|
|
|
|
:key="hotel"
|
|
|
|
|
:name="hotel.toLowerCase()"
|
2019-12-03 20:00:29 +08:00
|
|
|
|
:label="hotel"
|
|
|
|
|
/>
|
2019-12-03 18:36:21 +08:00
|
|
|
|
</n-dropdown>
|
2019-10-22 13:48:51 +08:00
|
|
|
|
```
|
|
|
|
|
```js
|
|
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
2019-12-02 20:57:09 +08:00
|
|
|
|
hotels: [
|
|
|
|
|
'Marina Bay Sands, Singapore', 'Brown’s Hotel, London', 'Atlantis Bahamas, Nassau', '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
|
|
|
|
```
|