From 59ca9f924c0a565802c209fba07914aa1478141c Mon Sep 17 00:00:00 2001 From: AdingApkgg Date: Fri, 26 Dec 2025 22:42:36 +0800 Subject: [PATCH] Remove anime.js dependency and refactor SearchResults and SettingsModal components for improved performance and consistency - Eliminated the use of anime.js in favor of simpler CSS transitions and effects. - Updated SearchResults.vue to implement virtual scrolling for better performance with large result sets. - Refactored SettingsModal.vue to enhance button interactions and remove unnecessary animation directives. - Improved overall styling and structure for a more cohesive user experience across components. --- src/components/ResultItem.vue | 66 ++++++++++++++++++++++++ src/components/SearchResults.vue | 86 +++++++++++++------------------- src/components/SettingsModal.vue | 17 ++----- src/main.ts | 7 --- vite.config.ts | 5 -- 5 files changed, 104 insertions(+), 77 deletions(-) create mode 100644 src/components/ResultItem.vue diff --git a/src/components/ResultItem.vue b/src/components/ResultItem.vue new file mode 100644 index 0000000..284bc6b --- /dev/null +++ b/src/components/ResultItem.vue @@ -0,0 +1,66 @@ + + + + + + diff --git a/src/components/SearchResults.vue b/src/components/SearchResults.vue index c6f9f6e..46af6c1 100644 --- a/src/components/SearchResults.vue +++ b/src/components/SearchResults.vue @@ -81,46 +81,33 @@ {{ platformData.error }} - -
- -
- -
- - {{ index + 1 }}. - - - {{ result.title }} - -
- - -
- - - {{ extractPath(result.url) }} - -
+ +
+ + + + + +
@@ -162,12 +149,13 @@ import { useSearchStore } from '@/stores/search' import type { PlatformData } from '@/stores/search' import { playTap } from '@/composables/useSound' import LazyRender from '@/components/LazyRender.vue' +import ResultItem from '@/components/ResultItem.vue' +import VirtualList from 'vue-virtual-scroll-list' import { ExternalLink, AlertTriangle, Crown, List, - Link as LinkIcon, ArrowDown, CheckCircle, Star, @@ -189,18 +177,6 @@ import { const searchStore = useSearchStore() -// 从URL中提取路径 -function extractPath(url: string): string { - try { - const urlObj = new URL(url) - // 返回路径部分(去掉域名) - return urlObj.pathname + urlObj.search + urlObj.hash - } catch { - // 如果URL解析失败,返回完整URL - return url - } -} - // 获取站点所有结果的唯一标签 function getUniqueTags(platformData: PlatformData) { const allTags = new Set() @@ -386,6 +362,12 @@ function getTagLabel(tag: string) { contain: layout style; } +/* 虚拟滚动列表容器 */ +.virtual-list-container { + max-height: 600px; + overflow-y: auto; +} + /* Tailwind 动画 - 优化为仅使用 transform 和 opacity */ .animate-fade-in { animation: fadeIn 0.5s ease-out; diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue index 3c5d42d..cce395d 100644 --- a/src/components/SettingsModal.vue +++ b/src/components/SettingsModal.vue @@ -12,13 +12,11 @@ >