# nextjs-dashboard
**Repository Path**: ilinxq/nextjs-dashboard
## Basic Information
- **Project Name**: nextjs-dashboard
- **Description**: next.js的学习
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-11-15
- **Last Updated**: 2025-01-31
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
## Next.js App Router Course - Starter
This is the starter template for the Next.js App Router Course. It contains the starting code for the dashboard application.
For more information, see the [course curriculum](https://nextjs.org/learn) on the Next.js Website.
## 说明
- nodejs镜像设置
为保证后面安装较顺利,需把nodejs设置为国内镜像(如华为):
```shell
npm config set registry https://mirrors.huaweicloud.com/repository/npm/
```
- 本练习来自
https://qufei1993.github.io/nextjs-learn-cn/
- npx创建指令的改进说明:
- 原始使用npm,如下:
```shell
npx create-next-app@latest nextjs-dashboard --use-npm --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example"
```
- 本项目采用pnpm,修改为如下:
```shell
npx create-next-app@latest nextjs-dashboard --use-pnpm --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example"
```
## 运行
- 安装项目包
```shell
pnpm i
```
- 运行开发服务
```shell
pnpm dev
```
## 路由说明
### page.tsx
`page.tsx` 是 Next.js 的一个特殊文件,它导出一个 React 组件,让该路由可访问是必需的。
- `/app/page.tsx` - 与路由 `/` 相关联。
- `/app/dashbord/page.tsx` - 与 `/dashboard`相关联。
- 在 Next.js 中创建不同页面的方式:使用文件夹创建新的路由段,并在其中添加一个 `page` 文件。
- 通过为页面文件使用特殊的名称,Next.js 允许你将 UI 组件、测试文件和其他相关代码与路由放置在一起。只有页面文件内部的内容才会被公开访问。例如,`/ui` 和 `/lib` 文件夹与你的路由一起放置在 `/app` 文件夹中。
### layout
- 在 Next.js 中,可以使用一个特殊的 layout.tsx 文件来创建在多个页面之间共享的 UI。
- `