mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
parent
a1ca50d003
commit
98ce810986
@ -7,7 +7,7 @@ const getClassNames = (name: string) => ({
|
|||||||
'leave-to': `van-${name}-leave-to van-${name}-leave-active leave-to-class leave-active-class`
|
'leave-to': `van-${name}-leave-to van-${name}-leave-active leave-to-class leave-active-class`
|
||||||
});
|
});
|
||||||
|
|
||||||
const nextTick = () => new Promise(resolve => setTimeout(resolve, 1000 / 30));
|
const nextTick = () => new Promise(resolve => setTimeout(resolve, 1000 / 20));
|
||||||
|
|
||||||
export const transition = function(showDefaultValue: boolean) {
|
export const transition = function(showDefaultValue: boolean) {
|
||||||
return Behavior({
|
return Behavior({
|
||||||
@ -84,11 +84,6 @@ export const transition = function(showDefaultValue: boolean) {
|
|||||||
const { classNames, duration } = this.data;
|
const { classNames, duration } = this.data;
|
||||||
const currentDuration = isObj(duration) ? duration.leave : duration;
|
const currentDuration = isObj(duration) ? duration.leave : duration;
|
||||||
|
|
||||||
if (+currentDuration === 0) {
|
|
||||||
this.onTransitionEnd();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Promise.resolve()
|
Promise.resolve()
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(() =>
|
.then(() =>
|
||||||
@ -97,6 +92,7 @@ export const transition = function(showDefaultValue: boolean) {
|
|||||||
currentDuration
|
currentDuration
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
.then(() => setTimeout(() => this.onTransitionEnd(), currentDuration))
|
||||||
.then(nextTick)
|
.then(nextTick)
|
||||||
.then(() =>
|
.then(() =>
|
||||||
this.set({
|
this.set({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user