mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[new feature] Popup: 添加 transitionEnd 事件
This commit is contained in:
parent
43496ce41c
commit
806f51ce35
@ -11,6 +11,9 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onTransitionEnd() {
|
||||||
|
console.log(`You can't see me 🌚`);
|
||||||
|
},
|
||||||
toggle(type) {
|
toggle(type) {
|
||||||
this.setData({
|
this.setData({
|
||||||
[`show.${type}`]: !this.data.show[type]
|
[`show.${type}`]: !this.data.show[type]
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
show="{{ show.middle }}"
|
show="{{ show.middle }}"
|
||||||
custom-class="center"
|
custom-class="center"
|
||||||
bind:close="togglePopup"
|
bind:close="togglePopup"
|
||||||
|
bind:transitionEnd="onTransitionEnd"
|
||||||
>
|
>
|
||||||
内容
|
内容
|
||||||
</van-popup>
|
</van-popup>
|
||||||
@ -17,6 +18,7 @@
|
|||||||
position="bottom"
|
position="bottom"
|
||||||
custom-class="bottom"
|
custom-class="bottom"
|
||||||
bind:close="toggleBottomPopup"
|
bind:close="toggleBottomPopup"
|
||||||
|
bind:transitionEnd="onTransitionEnd"
|
||||||
>
|
>
|
||||||
内容
|
内容
|
||||||
</van-popup>
|
</van-popup>
|
||||||
@ -28,6 +30,7 @@
|
|||||||
overlay="{{ false }}"
|
overlay="{{ false }}"
|
||||||
custom-class="top"
|
custom-class="top"
|
||||||
bind:close="toggleTopPopup"
|
bind:close="toggleTopPopup"
|
||||||
|
bind:transitionEnd="onTransitionEnd"
|
||||||
>
|
>
|
||||||
内容
|
内容
|
||||||
</van-popup>
|
</van-popup>
|
||||||
@ -38,6 +41,7 @@
|
|||||||
position="right"
|
position="right"
|
||||||
custom-class="right"
|
custom-class="right"
|
||||||
bind:close="toggleRightPopup"
|
bind:close="toggleRightPopup"
|
||||||
|
bind:transitionEnd="onTransitionEnd"
|
||||||
>
|
>
|
||||||
<van-button bind:click="toggleRightPopup" class="demo-margin-right">关闭弹层</van-button>
|
<van-button bind:click="toggleRightPopup" class="demo-margin-right">关闭弹层</van-button>
|
||||||
|
|
||||||
@ -47,6 +51,7 @@
|
|||||||
position="right"
|
position="right"
|
||||||
custom-class="right"
|
custom-class="right"
|
||||||
bind:close="toggleRightPopup2"
|
bind:close="toggleRightPopup2"
|
||||||
|
bind:transitionEnd="onTransitionEnd"
|
||||||
>
|
>
|
||||||
<van-button bind:click="toggleRightPopup2">关闭弹层</van-button>
|
<van-button bind:click="toggleRightPopup2">关闭弹层</van-button>
|
||||||
</van-popup>
|
</van-popup>
|
||||||
|
@ -62,6 +62,7 @@ Page({
|
|||||||
|-----------|-----------|-----------|
|
|-----------|-----------|-----------|
|
||||||
| bind:close | 蒙层关闭时触发 | - |
|
| bind:close | 蒙层关闭时触发 | - |
|
||||||
| bind:click-overlay | 点击蒙层时触发 | - |
|
| bind:click-overlay | 点击蒙层时触发 | - |
|
||||||
|
| bind:transitionEnd | 蒙层关闭后触发 | - |
|
||||||
|
|
||||||
### 外部样式类
|
### 外部样式类
|
||||||
|
|
||||||
|
@ -53,6 +53,10 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onTransitionEnd() {
|
||||||
|
!this.data.show && this.$emit('transitionEnd');
|
||||||
|
},
|
||||||
|
|
||||||
observeClass() {
|
observeClass() {
|
||||||
const { transition, position } = this.data;
|
const { transition, position } = this.data;
|
||||||
this.updateClasses(transition || position);
|
this.updateClasses(transition || position);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user