From 4f6d223da4c3a7feba6d953b5d1630cacf8a4648 Mon Sep 17 00:00:00 2001 From: momen Date: Sat, 11 Apr 2026 12:43:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=90=9C=E7=B4=A2=E8=81=9A=E7=84=A6?= =?UTF-8?q?=E5=92=8C=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6=E5=B9=B3=E6=BB=91?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=88=B0=E9=A1=B6=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在搜索框获得焦点和应用初始化时,除了切换分类外,添加平滑滚动到顶部的功能,提升用户体验 --- src/App.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index 95993248..1aa4a47c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1144,7 +1144,10 @@ const handleSearchInput = (value: string) => { }; const handleSearchFocus = () => { - if (activeCategory.value === "home") activeCategory.value = "all"; + if (activeCategory.value === "home") { + activeCategory.value = "all"; + window.scrollTo({ top: 0, behavior: "smooth" }); + } }; // 生命周期钩子 @@ -1252,6 +1255,7 @@ onMounted(async () => { const tryOpen = () => { // 先切换到"全部应用"分类 activeCategory.value = "all"; + window.scrollTo({ top: 0, behavior: "smooth" }); // 使用类似 HomeView 的方式打开应用,从两个仓库获取完整信息 const target = apps.value.find((a) => a.pkgname === data.pkgname); if (target) {