mirror of
https://github.com/zuiidea/antd-admin
synced 2026-11-02 07:53:59 +00:00
32 lines
949 B
TypeScript
32 lines
949 B
TypeScript
import { generateStaticParamsFor, importPage } from "nextra/pages";
|
|
import { useMDXComponents as getMDXComponents } from "../../mdx-components";
|
|
|
|
export const generateStaticParams = generateStaticParamsFor("mdxPath");
|
|
|
|
/** Nextra Docs Theme 在运行时会提供 `wrapper`;类型上可能为 optional。 */
|
|
const Wrapper = getMDXComponents().wrapper!;
|
|
|
|
type PageProps = { params: Promise<{ mdxPath?: string[] }> };
|
|
|
|
export async function generateMetadata(props: PageProps) {
|
|
const params = await props.params;
|
|
const { metadata } = await importPage(params.mdxPath);
|
|
return metadata;
|
|
}
|
|
|
|
export default async function Page(props: PageProps) {
|
|
const params = await props.params;
|
|
const {
|
|
default: MDXContent,
|
|
toc,
|
|
metadata,
|
|
sourceCode,
|
|
} = await importPage(params.mdxPath);
|
|
|
|
return (
|
|
<Wrapper toc={toc} metadata={metadata} sourceCode={sourceCode}>
|
|
<MDXContent {...props} params={params} />
|
|
</Wrapper>
|
|
);
|
|
}
|