From aaf6ca8e9f2884df3ccd5aabd9d46021a3c1ad1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Thu, 20 Feb 2025 10:49:20 +0800 Subject: [PATCH] =?UTF-8?q?optimize:=20=E4=BC=98=E5=8C=96=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=A1=86=E5=BF=AB=E6=8D=B7=E9=94=AE=E5=A4=84=E7=90=86?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/gui/src/view/App.vue | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/packages/gui/src/view/App.vue b/packages/gui/src/view/App.vue index 5f02614..1bca52d 100644 --- a/packages/gui/src/view/App.vue +++ b/packages/gui/src/view/App.vue @@ -43,13 +43,17 @@ export default { }) ipcRenderer.on('search-bar', (_, message) => { - console.info(_, message) - if (message.key === 'show-hide') { - if (window.config.disableSearchBar) { - this.hideSearchBar = true - return - } + if (window.config.disableSearchBar) { + this.hideSearchBar = true + return + } + // 如果不是显示/隐藏操作,并且还未显示检索框,先按显示操作处理 + if (message.key !== 'show-hide' && this.hideSearchBar) { + message = { key: 'show-hide' } + } + + if (message.key === 'show-hide') { // 显示/隐藏 this.hideSearchBar = message.hideSearchBar != null ? message.hideSearchBar : !this.hideSearchBar // 显示后,获取输入框焦点 @@ -61,18 +65,10 @@ export default { } }, 100) } - } else { - // 如果还未显示检索框,先显示出来 - if (this.hideSearchBar) { - this.hideSearchBar = false - return - } - - if (message.key === 'next' && !this.hideSearchBar) { - this.$refs.searchBar.next() - } else if (message.key === 'previous' && !this.hideSearchBar) { - this.$refs.searchBar.previous() - } + } else if (message.key === 'next') { // 下一项 + this.$refs.searchBar.next() + } else if (message.key === 'previous') { // 上一项 + this.$refs.searchBar.previous() } }) },