diff --git a/src/App.vue b/src/App.vue
index efb5bfb..b278080 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -13,6 +13,14 @@
{{ repo.label }}
+
+
更新时间:{{ repoUpdateTime }}
@@ -23,7 +31,7 @@
handleTreeSelect(selectedKeys, event, category.name)"
>
@@ -149,6 +157,43 @@ const mirrorUrls = [
"https://mirror.ghproxy.com/{0}"
];
+// 添加树搜索相关的响应式变量
+const treeSearchText = ref('');
+const filteredTreeData = reactive({});
+
+// 添加树搜索处理函数
+const handleTreeSearch = () => {
+ repoData.value.forEach(category => {
+ if (showTree(category)) {
+ if (!treeSearchText.value) {
+ filteredTreeData[category.name] = getCategoryTree(category);
+ } else {
+ const searchText = treeSearchText.value.toLowerCase();
+ const originalTree = getCategoryTree(category);
+ filteredTreeData[category.name] = filterTreeNodes(originalTree, searchText);
+ }
+ }
+ });
+};
+
+// 添加树节点过滤函数
+const filterTreeNodes = (nodes, searchText) => {
+ return nodes.map(node => {
+ const newNode = { ...node };
+ if (newNode.children) {
+ newNode.children = filterTreeNodes(newNode.children, searchText);
+ }
+
+ if (
+ newNode.title.toLowerCase().includes(searchText) ||
+ (newNode.children && newNode.children.length > 0)
+ ) {
+ return newNode;
+ }
+ return null;
+ }).filter(Boolean);
+};
+
// 修改 repoOptions 的定义
const repoOptions = computed(() => {
if (mode === 'single') {
@@ -207,6 +252,7 @@ const fetchRepoData = async () => {
// 清空现有数据
repoDataRaw.value = [];
repoUpdateTime.value = '';
+ treeSearchText.value = ''; // 清空树搜索文本
Object.keys(searchConditions).forEach(key => {
searchConditions[key] = {
name: '',
@@ -571,4 +617,4 @@ onMounted(() => {
overflow: visible;
text-overflow: clip;
}
-
\ No newline at end of file
+