mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[new feature] Popup: add opened/closed event (#2650)
This commit is contained in:
parent
466bb3ce1e
commit
01c893abcb
@ -55,5 +55,7 @@ Use `position` prop to set popup display position
|
||||
| Event | Description | Arguments |
|
||||
|------|------|------|
|
||||
| open | Triggered when open Popup | - |
|
||||
| opened | Triggered when opened Popup | - |
|
||||
| close | Triggered when close Popup | - |
|
||||
| closed | Triggered when closed Popup | - |
|
||||
| click-overlay | Triggered when click overlay | - |
|
||||
|
@ -25,10 +25,15 @@ export default sfc({
|
||||
}
|
||||
|
||||
const { position } = this;
|
||||
const emit = event => () => this.$emit(event);
|
||||
const transitionName = this.transition || (position ? `van-popup-slide-${position}` : 'van-fade');
|
||||
|
||||
return (
|
||||
<transition name={transitionName}>
|
||||
<transition
|
||||
name={transitionName}
|
||||
onAfterEnter={emit('opened')}
|
||||
onAfterLeave={emit('closed')}
|
||||
>
|
||||
<div vShow={this.value} class={bem({ [position]: position })}>
|
||||
{this.$slots.default}
|
||||
</div>
|
||||
|
@ -55,5 +55,7 @@ export default {
|
||||
| 事件名 | 说明 | 参数 |
|
||||
|------|------|------|
|
||||
| open | 打开弹出层时触发 | - |
|
||||
| opened | 打开弹出层且动画结束后触发 | - |
|
||||
| close | 关闭弹出层时触发 | - |
|
||||
| closed | 关闭弹出层且动画结束后触发 | - |
|
||||
| click-overlay | 点击蒙层时触发 | - |
|
||||
|
Loading…
x
Reference in New Issue
Block a user