feat(SSR): 将服务支持页面改为SSR

This commit is contained in:
2025-09-28 16:27:01 +08:00
parent a7a4551528
commit d4c079286e
3 changed files with 59 additions and 77 deletions

View File

@ -1,7 +1,7 @@
<template>
<div class="page-container">
<div v-if="pending" class="flex justify-center items-center h-64">
<el-spinner />
<el-skeleton :rows="6" animated />
</div>
<div v-else>
<support-tabs model-value="faq" />
@ -37,22 +37,17 @@
const { getStrapiLocale } = useLocalizations();
const strapiLocale = getStrapiLocale();
const questions = ref<Question[]>([]);
const { data, pending, error } = useAsyncData('questions', () =>
find<Question>('questions', {
locale: strapiLocale,
})
);
const pending = ref(true);
const questions = computed(() => data.value?.data ?? null);
onMounted(async () => {
try {
const faqData = await find<Question>('questions', {
locale: strapiLocale,
});
if (faqData) {
questions.value = faqData.data || [];
}
} catch (error) {
console.error('Failed to fetch FAQ data:', error);
} finally {
pending.value = false;
watch(error, (value) => {
if (value) {
console.error('数据获取失败: ', value);
}
});
</script>