From 79c366d1f211dc5b48b17a61a19bfc3a4cab4027 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 8 Feb 2020 18:02:28 +0900 Subject: [PATCH] Update container.vue --- src/client/components/ui/container.vue | 27 +++++++++++--------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/client/components/ui/container.vue b/src/client/components/ui/container.vue index 66f55102be..4e7c9420ab 100644 --- a/src/client/components/ui/container.vue +++ b/src/client/components/ui/container.vue @@ -9,10 +9,8 @@ @@ -62,27 +60,23 @@ export default Vue.extend({ this.showBody = show; }, - beforeEnter(el) { - el.style.height = '0'; - }, enter(el) { - setTimeout(() => { - el.style.height = el.scrollHeight + 'px'; - }, 10); // HACKY: Vueのバグか知らないけどこうしないと動作しない + const elementHeight = el.getBoundingClientRect().height; + el.style.height = 0; + el.offsetHeight; // reflow + el.style.height = elementHeight + 'px'; }, afterEnter(el) { - el.style.height = 'auto'; - }, - beforeLeave(el) { - el.style.height = el.scrollHeight + 'px'; + el.style.height = null; }, leave(el) { - setTimeout(() => { - el.style.height = '0'; - }, 10); // HACKY: Vueのバグか知らないけどこうしないと動作しない + const elementHeight = el.getBoundingClientRect().height; + el.style.height = elementHeight + 'px'; + el.offsetHeight; // reflow + el.style.height = 0; }, afterLeave(el) { - el.style.height = 'auto'; + el.style.height = null; }, } }); @@ -90,6 +84,7 @@ export default Vue.extend({