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
|
<van-popup
|
||||||
show="{{ show.middle }}"
|
show="{{ show.middle }}"
|
||||||
custom-class="center"
|
custom-class="center"
|
||||||
|
transition="none"
|
||||||
bind:close="togglePopup"
|
bind:close="togglePopup"
|
||||||
bind:transitionEnd="onTransitionEnd"
|
bind:transitionEnd="onTransitionEnd"
|
||||||
>
|
>
|
||||||
|
@ -60,6 +60,7 @@ export const transition = function(showDefaultValue: boolean) {
|
|||||||
|
|
||||||
show() {
|
show() {
|
||||||
const { classNames, duration } = this.data;
|
const { classNames, duration } = this.data;
|
||||||
|
const currentDuration = isObj(duration) ? duration.leave : duration;
|
||||||
|
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
@ -68,7 +69,7 @@ export const transition = function(showDefaultValue: boolean) {
|
|||||||
inited: true,
|
inited: true,
|
||||||
display: true,
|
display: true,
|
||||||
classes: classNames.enter,
|
classes: classNames.enter,
|
||||||
currentDuration: isObj(duration) ? duration.enter : duration
|
currentDuration
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
@ -81,13 +82,19 @@ export const transition = function(showDefaultValue: boolean) {
|
|||||||
|
|
||||||
leave() {
|
leave() {
|
||||||
const { classNames, duration } = this.data;
|
const { classNames, duration } = this.data;
|
||||||
|
const currentDuration = isObj(duration) ? duration.leave : duration;
|
||||||
|
|
||||||
|
if (+currentDuration === 0) {
|
||||||
|
this.onTransitionEnd();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(() =>
|
.then(() =>
|
||||||
this.set({
|
this.set({
|
||||||
classes: classNames.leave,
|
classes: classNames.leave,
|
||||||
currentDuration: isObj(duration) ? duration.leave : duration
|
currentDuration
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
|
@ -116,14 +116,3 @@
|
|||||||
.van-right-leave-to {
|
.van-right-leave-to {
|
||||||
transform: translate3d(100%, -50%, 0);
|
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() {
|
observeClass() {
|
||||||
const { transition, position } = this.data;
|
const { transition, position } = this.data;
|
||||||
this.updateClasses(transition || position);
|
this.updateClasses(transition || position);
|
||||||
|
|
||||||
|
if (transition === 'none') {
|
||||||
|
this.set({ duration: 0 });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
show="{{ show }}"
|
show="{{ show }}"
|
||||||
z-index="{{ zIndex }}"
|
z-index="{{ zIndex }}"
|
||||||
custom-style="{{ overlayStyle }}"
|
custom-style="{{ overlayStyle }}"
|
||||||
duration="{{ transition === 'none' ? 1 : duration }}"
|
duration="{{ duration }}"
|
||||||
bind:click="onClickOverlay"
|
bind:click="onClickOverlay"
|
||||||
/>
|
/>
|
||||||
<view
|
<view
|
||||||
|
Loading…
x
Reference in New Issue
Block a user