Next.js 有两个路由系统。Pages Router (pages/) 是原始的;App Router (app/,自 Next 13 以来)是更新的、推荐的,围绕 React Server Components 构建。
文件和约定差异
text
Pages Router (pages/) App Router (app/)
──────────────────────────────────────────────────────
pages/about.tsx → /about app/about/page.tsx → /about
Default export = page page.tsx = page, layout.tsx = layout
getServerSideProps (SSR) async Server Components (fetch directly)
getStaticProps (SSG) fetch() with caching options
_app.tsx / _document.tsx Nested layout.tsx files
All components client-rendered Server Components by default
