feat: 完成网站前端的基本建设

- 网站内容展示:首页, 产品页, 解决方案, 联系信息等
- 网站跳转逻辑:通过Vue-Router实现路由跳转
- 后端通信: 通过Nuxt Strapi与后端Strapi服务进行通信
This commit is contained in:
2025-09-06 15:59:52 +08:00
parent 6470da9792
commit f957adfa5d
52 changed files with 3358 additions and 92 deletions

34
app/utils/markdown.ts Normal file
View File

@ -0,0 +1,34 @@
import MarkdownIt from 'markdown-it';
const md = new MarkdownIt({
html: true,
linkify: true,
typographer: true,
breaks: true,
})
export function renderMarkdown(content: string): string {
const dirtyHtml = md.render(content);
if (typeof window !== 'undefined') {
import('dompurify').then((DOMPurify => {
return DOMPurify.default.sanitize(dirtyHtml)
}))
}
return dirtyHtml
}
export function convertMedia(content: string): string {
// 通过正则表达式替换Markdown中的图片链接
// ![alt text](image-url) -> ![alt text](strapiMedia(image-url))
if(!content) return '';
const contentWithAbsoluteUrls = content.replace(
/!\[([^\]]*)\]\((\/uploads\/[^)]+)\)/g,
(_, alt, url) => `![${alt}](${useStrapiMedia(url)})`
)
return contentWithAbsoluteUrls;
}