From 642a51a558550d801688a9a16cd640451c05288e Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 12 Feb 2022 17:29:15 +0900 Subject: [PATCH] =?UTF-8?q?fix(client):=20nextTick=E3=81=AE=E4=B8=AD?= =?UTF-8?q?=E3=81=A7onUnmounted=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=82=82=E5=8A=B9=E3=81=8B=E3=81=AA=E3=81=84=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E6=80=A7=E3=81=8C=E3=81=82=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/components/ui/tooltip.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/client/src/components/ui/tooltip.vue b/packages/client/src/components/ui/tooltip.vue index 3ccd1b731..ee1909554 100644 --- a/packages/client/src/components/ui/tooltip.vue +++ b/packages/client/src/components/ui/tooltip.vue @@ -180,12 +180,12 @@ const setPosition = () => { el.value.style.top = top + 'px'; }; +let loopHandler; + onMounted(() => { nextTick(() => { setPosition(); - let loopHandler; - const loop = () => { loopHandler = window.requestAnimationFrame(() => { setPosition(); @@ -194,12 +194,12 @@ onMounted(() => { }; loop(); - - onUnmounted(() => { - window.cancelAnimationFrame(loopHandler); - }); }); }); + +onUnmounted(() => { + window.cancelAnimationFrame(loopHandler); +});