From c9c84e518bca294fbdde80635bed172f38e7b199 Mon Sep 17 00:00:00 2001 From: xiyidaiwa Date: Tue, 14 Apr 2026 14:07:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=90=9C=E7=B4=A2):=20=E4=B8=BA=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E8=BE=93=E5=85=A5=E6=A1=86=E6=B7=BB=E5=8A=A0=E6=B8=85?= =?UTF-8?q?=E9=99=A4=E6=8C=89=E9=92=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在AppHeader和UpdateCenterToolbar组件中为搜索输入框添加清除按钮 点击按钮可清空搜索内容并触发相应事件 --- src/components/AppHeader.vue | 19 +++++++++++++++++++ .../update-center/UpdateCenterToolbar.vue | 15 ++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/components/AppHeader.vue b/src/components/AppHeader.vue index a8620f1a..f12137fb 100644 --- a/src/components/AppHeader.vue +++ b/src/components/AppHeader.vue @@ -22,7 +22,17 @@ placeholder="搜索应用名 / 包名 / 标签,按回车键搜索" @keydown.enter="handleSearch" @focus="handleSearchFocus" + @input="handleInput" /> + @@ -106,4 +115,8 @@ const handleInput = (event: Event): void => { const target = event.target as HTMLInputElement | null; emit("update:search-query", target?.value ?? props.searchQuery); }; + +const clearSearch = () => { + emit("update:search-query", ""); +};