Pages
页面是路由唯一的UI。您可以通过在一个page.js文件中定义一个默认输出的组件来生成页面。
例如, 在app目录中添加一个page.js文件来创建index页面 :
// `app/page.tsx` is the UI for the `/` URL
export default function Page() {
return <h1>Hello, Home page!</h1>;
}
然后, 通过创建一个新文件夹并添加page.js文件在其中来创建更多的页面。例如:你能够创建一个新的dashboard文件夹,并且创建一个page.js文件在其文件夹中,来创建一个/dashboard路由。
// `app/dashboard/page.tsx` is the UI for the `/dashboard` URL
export default function Page() {
return <h1>Hello, Dashboard Page!</h1>;
}
您需要知道: