mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
[bugfix] Transition: behavior error when set duration zero
This commit is contained in:
parent
5cd20000d1
commit
b5238ed753
@ -3,6 +3,7 @@
|
||||
<van-popup
|
||||
show="{{ show.middle }}"
|
||||
custom-class="center"
|
||||
transition="none"
|
||||
bind:close="togglePopup"
|
||||
bind:transitionEnd="onTransitionEnd"
|
||||
>
|
||||
|
@ -60,6 +60,7 @@ export const transition = function(showDefaultValue: boolean) {
|
||||
|
||||
show() {
|
||||
const { classNames, duration } = this.data;
|
||||
const currentDuration = isObj(duration) ? duration.leave : duration;
|
||||
|
||||
Promise.resolve()
|
||||
.then(nextTick)
|
||||
@ -68,7 +69,7 @@ export const transition = function(showDefaultValue: boolean) {
|
||||
inited: true,
|
||||
display: true,
|
||||
classes: classNames.enter,
|
||||
currentDuration: isObj(duration) ? duration.enter : duration
|
||||
currentDuration
|
||||
})
|
||||
)
|
||||
.then(nextTick)
|
||||
@ -81,13 +82,19 @@ export const transition = function(showDefaultValue: boolean) {
|
||||
|
||||
leave() {
|
||||
const { classNames, duration } = this.data;
|
||||
const currentDuration = isObj(duration) ? duration.leave : duration;
|
||||
|
||||
if (+currentDuration === 0) {
|
||||
this.onTransitionEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
Promise.resolve()
|
||||
.then(nextTick)
|
||||
.then(() =>
|
||||
this.set({
|
||||
classes: classNames.leave,
|
||||
currentDuration: isObj(duration) ? duration.leave : duration
|
||||
currentDuration
|
||||
})
|
||||
)
|
||||
.then(nextTick)
|
||||
|
@ -116,14 +116,3 @@
|
||||
.van-right-leave-to {
|
||||
transform: translate3d(100%, -50%, 0);
|
||||
}
|
||||
|
||||
.van-none-enter-active,
|
||||
.van-none-leave-active {
|
||||
transition-duration: 1ms !important;
|
||||
transition-property: opacity;
|
||||
}
|
||||
|
||||
.van-none-enter,
|
||||
.van-none-leave-to {
|
||||
opacity: 0.999;
|
||||
}
|
||||
|
@ -56,6 +56,10 @@ VantComponent({
|
||||
observeClass() {
|
||||
const { transition, position } = this.data;
|
||||
this.updateClasses(transition || position);
|
||||
|
||||
if (transition === 'none') {
|
||||
this.set({ duration: 0 });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -6,7 +6,7 @@
|
||||
show="{{ show }}"
|
||||
z-index="{{ zIndex }}"
|
||||
custom-style="{{ overlayStyle }}"
|
||||
duration="{{ transition === 'none' ? 1 : duration }}"
|
||||
duration="{{ duration }}"
|
||||
bind:click="onClickOverlay"
|
||||
/>
|
||||
<view
|
||||
|
Loading…
x
Reference in New Issue
Block a user