Files
hjc-web/app/pages/preview.vue
T
weicw-dshsa b88c9df3b3 chore(templates): 只保留 template-07,删除其余 9 套模板
汇吉采仅使用 template-07(后端绑定 + .env.development),其余
template-01~06、08~10 为多租户 SaaS 平台时代遗留,全部删除:

- 删除 app/templates/ 下 9 套模板目录及注册表内对应配置
- 删除 public/images/template-{01,03,09,10} 图片目录
- 删除 templates/cloud-website 下 9 张模板预览图
- 三处 template-01 兜底(nuxt.config / useTemplate / default.vue)改为 07
- 清理指向已删模板的注释,README 模板系统章节同步更新

模板动态加载机制保留:新增模板 = 建目录 + 在 app/templates/index.ts 注册
2026-09-30 07:38:05 +08:00

42 lines
1.1 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div>
<Component :is="templatePage" v-if="templatePage" />
</div>
</template>
<script setup lang="ts">
/**
* 模板预览路由
* 可通过 /preview?templateId=template-07 预览指定模板
*/
const route = useRoute()
const previewTemplateId = route.query.templateId as string
const { loadTemplate, registerTemplate } = useTemplate()
const { siteInfo, fetchSiteInfo } = useSite()
// 先取站点信息,保证标题能带上品牌名(与其它页面一致)
await fetchSiteInfo()
usePageSeo(
{
title: '模板预览',
path: '/preview'
},
siteInfo.value
)
// 预览页仅供内部调试,不希望被搜索引擎收录
useSeoMeta({ robots: 'noindex, nofollow' })
// 注册所有模板
const templates = await import('~/templates')
templates.default.forEach(registerTemplate)
const templatePage = shallowRef<Component | null>(null)
// 同步加载当前模板(SSR/客户端路由切换均直接 await,避免先闪 SiteLoading)
const components = await loadTemplate(previewTemplateId)
templatePage.value = components?.Home || null
</script>