-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
- import { Search } from '@element-plus/icons-vue';
-
// i18n相关
const { t } = useI18n();
const { getDirectusLocale } = useLocalizations();
@@ -97,8 +25,6 @@
// 路由相关
const route = useRoute();
- const router = useRouter();
- const localePath = useLocalePath();
// 搜索相关
const { search } = useMeilisearch();
@@ -144,44 +70,10 @@
})
);
- console.log(searchItems.value);
-
- // 分类控制
- const activeTab = ref('all');
- const resultCount = computed(() => {
- const map: Record = { all: searchItems.value.length };
- for (const item of searchItems.value) {
- map[item.type] = (map[item.type] ?? 0) + 1;
- }
- return map;
- });
-
- // 分页控制
- const currentPage = ref(1);
-
const hasResults = computed(() =>
filteredSections.value.some((section) => section.hits.length > 0)
);
- const navigateToQuery = (value: string) => {
- const trimmed = value.trim();
- if (!trimmed) return;
- navigateTo({
- path: localePath('/search'),
- query: { query: trimmed },
- });
- };
-
- const handleClear = () => {
- keyword.value = '';
- sections.value = [];
- router.replace(localePath({ path: '/search' }));
- };
-
- watch(activeTab, () => {
- currentPage.value = 1; // 重置页码
- });
-
watch(
() => route.query.query,
async (newQuery) => {
@@ -216,42 +108,6 @@
min-height: 70vh;
}
- .search-header {
- display: flex;
- flex-direction: column;
- gap: 1rem;
- margin-bottom: 2rem;
- }
-
- .page-title {
- font-size: 2.25rem;
- font-weight: 600;
- color: var(--el-text-color-primary);
- }
-
- .search-bar {
- display: flex;
- gap: 1rem;
- align-items: center;
- font-size: 16px;
- }
-
- .search-input {
- flex: 1;
- height: 50px;
- }
-
- .search-button {
- height: 50px;
- width: 100px;
- font-size: 16px;
- }
-
- .search-meta {
- font-size: 0.9rem;
- color: var(--el-text-color-secondary);
- }
-
.search-state {
display: flex;
justify-content: center;