feat(SSR): 为站点添加SSR机制 #38

Manually merged
remilia merged 9 commits from feat/ssr into master 2025-09-28 16:58:29 +08:00
12 changed files with 425 additions and 398 deletions
Showing only changes of commit 1c98921e01 - Show all commits

View File

@ -109,7 +109,6 @@
data: sections, data: sections,
pending: loading, pending: loading,
error, error,
refresh,
} = await useAsyncData( } = await useAsyncData(
() => `search-${route.query.query ?? ''}`, () => `search-${route.query.query ?? ''}`,
async () => { async () => {
@ -210,6 +209,12 @@
} }
); );
watch(error, (value) => {
if (value) {
console.error('数据获取失败: ', value);
}
});
onMounted(() => { onMounted(() => {
if (typeof route.query.query === 'string' && route.query.query.trim()) if (typeof route.query.query === 'string' && route.query.query.trim())
keyword.value = route.query.query; keyword.value = route.query.query;