0610.1
All checks were successful
Next.js CI/CD 流水线 / deploy (push) Successful in 4m44s

This commit is contained in:
2025-06-10 16:14:49 +08:00
parent d8398afa12
commit 27733bd91e
92 changed files with 6731 additions and 273 deletions

View File

@@ -0,0 +1,32 @@
//src\pages\test\markdown\index.tsx
import { useEffect, useState } from 'react';
import Markdown from '@/components/markdown2'; // 引入你刚刚创建的 Markdown 组件
export default function MarkdownPage() {
const [markdownContent, setMarkdownContent] = useState<string | null>(null);
// 使用 useEffect 钩子来加载 public 文件夹中的 Markdown 文件内容
useEffect(() => {
// 从 public 文件夹中获取文件内容
fetch('/md2.md')
.then((response) => response.text())
.then((text) => {
setMarkdownContent(text);
})
.catch((error) => {
console.error('Error loading Markdown file:', error);
});
}, []);
// 当文件内容加载后,显示 Markdown 组件
return (
<div style={{ padding: '20px' }}>
{markdownContent ? (
<Markdown>{markdownContent}</Markdown>
) : (
<p>Loading Markdown content...</p>
)}
</div>
);
}