Garlic Garlic

Nextjs的使用总结

发表于 阅读时长1分钟

nextjs特性 服务端渲染SSR

静态站点生成SSG

API路由

文件系统路由

图像优化

.next目录是运行的文件、app是路由目录、public用于存放一些静态资源

所有路由文件放在app中,page.tsx内容页,layout.tsx是页面布局的模板。 还有error页、loading页、not-found页。

[xxx]是带参数的路由目录,动态渲染

generateMetadata 动态元数据取决于动态信息,只能在server component中使用

generateStaticParams

[slug] [...slug]

接口

layout和page

路由的规律

"use client"

window document is not defined