mirror of
https://gitee.com/spark-store-project/spark-store
synced 2026-06-22 06:03:49 +08:00
fix: 搜索聚焦和初始化时平滑滚动到顶部
在搜索框获得焦点和应用初始化时,除了切换分类外,添加平滑滚动到顶部的功能,提升用户体验
This commit is contained in:
+5
-1
@@ -1144,7 +1144,10 @@ const handleSearchInput = (value: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSearchFocus = () => {
|
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 = () => {
|
const tryOpen = () => {
|
||||||
// 先切换到"全部应用"分类
|
// 先切换到"全部应用"分类
|
||||||
activeCategory.value = "all";
|
activeCategory.value = "all";
|
||||||
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
// 使用类似 HomeView 的方式打开应用,从两个仓库获取完整信息
|
// 使用类似 HomeView 的方式打开应用,从两个仓库获取完整信息
|
||||||
const target = apps.value.find((a) => a.pkgname === data.pkgname);
|
const target = apps.value.find((a) => a.pkgname === data.pkgname);
|
||||||
if (target) {
|
if (target) {
|
||||||
|
|||||||
Reference in New Issue
Block a user