docs(Popover): add select event demo

This commit is contained in:
chenjiahan
2020-11-20 14:26:41 +08:00
committed by neverland
parent 27ed9d1fb7
commit 1999195c46
3 changed files with 27 additions and 2 deletions
+8 -1
View File
@@ -20,7 +20,7 @@ Vue.use(Popover);
当 Popover 弹出时,会基于 `reference` 插槽的内容进行定位。
```html
<van-popover v-model="showPopover" :actions="actions">
<van-popover v-model="showPopover" :actions="actions" @select="onSelect">
<template #reference>
<van-button type="primary" @click="showPopover = true">
浅色风格
@@ -30,6 +30,8 @@ Vue.use(Popover);
```
```js
import { Toast } from 'vant';
export default {
data() {
return {
@@ -38,6 +40,11 @@ export default {
actions: [{ text: '选项一' }, { text: '选项二' }, { text: '选项三' }],
};
},
methods: {
onSelect(action) {
Toast(action.text);
},
},
};
```