From 39554b9b7281bcf05e2c37de20ea5cca7160c7ba Mon Sep 17 00:00:00 2001 From: zyronon Date: Thu, 2 Nov 2023 10:38:09 +0800 Subject: [PATCH] Fixed a bug where toolbar could not be automatically closed --- src/components/Toolbar/Toolbar.vue | 15 ++++++++------- src/stores/setting.ts | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/Toolbar/Toolbar.vue b/src/components/Toolbar/Toolbar.vue index a14370b4..6a6a6ce0 100644 --- a/src/components/Toolbar/Toolbar.vue +++ b/src/components/Toolbar/Toolbar.vue @@ -29,13 +29,14 @@ const showFeedbackModal = $ref(false) const showSettingModal = $ref(false) const headerRef = $ref(null) -watch(() => settingStore.showToolbar, n => { - if (headerRef) { - if (n) { - headerRef.style.marginTop = '10rem' +watch([() => settingStore.showToolbar, () => headerRef], n => { + console.log('n', n) + if (n[1]) { + if (n[0]) { + n[1].style.marginTop = '10rem' } else { - let rect = headerRef.getBoundingClientRect() - headerRef.style.marginTop = `-${rect.height}px` + let rect = n[1].getBoundingClientRect() + n[1].style.marginTop = `-${rect.height}px` } } }) @@ -55,7 +56,7 @@ watch(() => settingStore.showToolbar, n => { -
+