From 6c679c5a4f777e08dec059b682f86d42c78ae493 Mon Sep 17 00:00:00 2001 From: daiwei Date: Tue, 8 Dec 2020 19:55:19 +0800 Subject: [PATCH 1/2] fix(runtime-dom): v-show leaves is not working with transition --- packages/runtime-dom/src/directives/vShow.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/runtime-dom/src/directives/vShow.ts b/packages/runtime-dom/src/directives/vShow.ts index f94ac3bae3b..417c11e2aa6 100644 --- a/packages/runtime-dom/src/directives/vShow.ts +++ b/packages/runtime-dom/src/directives/vShow.ts @@ -31,6 +31,7 @@ export const vShow: ObjectDirective = { }) } } else { + if (!oldValue === !value) return setDisplay(el, value) } }, From ea831eaef1695149d1cea7079b8fe1f13aec0f90 Mon Sep 17 00:00:00 2001 From: daiwei Date: Tue, 8 Dec 2020 21:06:06 +0800 Subject: [PATCH 2/2] fix: update --- packages/runtime-dom/src/directives/vShow.ts | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/runtime-dom/src/directives/vShow.ts b/packages/runtime-dom/src/directives/vShow.ts index 417c11e2aa6..6687485e012 100644 --- a/packages/runtime-dom/src/directives/vShow.ts +++ b/packages/runtime-dom/src/directives/vShow.ts @@ -20,18 +20,19 @@ export const vShow: ObjectDirective = { } }, updated(el, { value, oldValue }, { transition }) { - if (transition && value !== oldValue) { - if (value) { - transition.beforeEnter(el) - setDisplay(el, true) - transition.enter(el) - } else { - transition.leave(el, () => { - setDisplay(el, false) - }) + if (transition) { + if (value !== oldValue) { + if (value) { + transition.beforeEnter(el) + setDisplay(el, true) + transition.enter(el) + } else { + transition.leave(el, () => { + setDisplay(el, false) + }) + } } } else { - if (!oldValue === !value) return setDisplay(el, value) } },