feat: 更新搜索逻辑

现在更换app类别时将默认清空搜索。
This commit is contained in:
Elysia
2026-02-12 20:11:54 +08:00
parent c3ae477497
commit d5266c6af8
4 changed files with 17 additions and 31 deletions

View File

@@ -16,25 +16,6 @@
---
## TODO
- [ ] 完善项目文档
- [x] 可以展示应用列表及其详细信息
- [ ] 实现应用下载&下载列表管理
- [x] 实现应用安装&重试安装
- [x] 实现应用卸载
- [x] 实现应用更新
- [x] 显示本地已安装app
- [x] 支持显示本地是否已经安装
- [x] 本地应用列表区分依赖和用户安装的包(或者干脆不显示依赖包)
- [x] 安装/卸载时UI提示重要
- [x] 实现应用搜索
- [ ] 切换分类时默认不应用搜索,需按下回车键才应用搜索
- [x] 修改UI使其更美观考虑换成如tailwindcss等库
- [x] 实现URL Shceme协议支持
- [ ] 动画性能问题
## 📦 关于 APM
**APM (AmberPM)** 是基于 `fuse-overlayfs` + `dpkg` + `AmberCE` 的容器化兼容层,为多发行版提供轻量级的应用运行方案。
@@ -190,7 +171,7 @@ apm-app-store/
## 📄 开源协议
本项目采用 [MulanPSL-2.0](LICENSE) 协议开源。
本项目采用 [MulanPSL-2.0](LICENSE.md) 协议开源。
---

View File

@@ -18,6 +18,7 @@
<main class="flex-1 px-4 py-6 lg:px-10">
<AppHeader
:search-query="searchQuery"
:active-category="activeCategory"
:apps-count="filteredApps.length"
@update-search="handleSearchInput"
@update="handleUpdate"
@@ -233,6 +234,7 @@ const toggleTheme = () => {
const selectCategory = (category: string) => {
activeCategory.value = category;
searchQuery.value = "";
};
const openDetail = (app: App) => {

View File

@@ -12,8 +12,8 @@
id="searchBox"
v-model="localSearchQuery"
class="w-full rounded-2xl border border-slate-200/70 bg-white/80 py-3 pl-12 pr-4 text-sm text-slate-700 shadow-sm outline-none transition placeholder:text-slate-400 focus:border-brand/50 focus:ring-4 focus:ring-brand/10 dark:border-slate-800/70 dark:bg-slate-900/60 dark:text-slate-200"
placeholder="搜索应用名 / 包名 / 标签"
@input="debounceSearch"
placeholder="搜索应用名 / 包名 / 标签,按回车键搜索"
@keydown.enter="handleSearch"
/>
</div>
</div>
@@ -30,6 +30,7 @@ import TopActions from "./TopActions.vue";
const props = defineProps<{
searchQuery: string;
activeCategory: string;
appsCount: number;
}>();
@@ -40,13 +41,9 @@ const emit = defineEmits<{
}>();
const localSearchQuery = ref(props.searchQuery || "");
const timeoutId = ref<ReturnType<typeof setTimeout> | null>(null);
const debounceSearch = () => {
if (timeoutId.value) clearTimeout(timeoutId.value);
timeoutId.value = setTimeout(() => {
const handleSearch = () => {
emit("update-search", localSearchQuery.value);
}, 220);
};
watch(
@@ -55,4 +52,11 @@ watch(
localSearchQuery.value = newVal || "";
},
);
watch(
() => props.activeCategory,
() => {
localSearchQuery.value = "";
},
);
</script>

View File

@@ -159,10 +159,9 @@ const onProgress = (_event: any, chunk: string) => {
scrollToBottom();
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const onComplete = (
_event: any,
result: { success: boolean; message: any },
_event: unknown,
result: { success: boolean; message: unknown },
) => {
if (!uninstalling.value) return; // Ignore if not current session