fix: 搜索聚焦和初始化时平滑滚动到顶部

在搜索框获得焦点和应用初始化时,除了切换分类外,添加平滑滚动到顶部的功能,提升用户体验
This commit is contained in:
2026-04-11 12:43:40 +08:00
parent 180b88b5c0
commit 4f6d223da4
+5 -1
View File
@@ -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) {