-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into main
- Loading branch information
Showing
3 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,38 @@ | ||
# 基础概念 | ||
# 基础概念 | ||
|
||
最新的 `3.0` 版本,整个项目进行了重构,现在我们将会介绍一些基础概念,以便于你更好的理解整个文档,请务必仔先阅读这一部分。 | ||
|
||
::: tip | ||
以下所讲全部针对源码根目录下的 `./web` 里的结构 | ||
::: | ||
|
||
## 全局类型 | ||
|
||
由于新版采用 `Typescript` 所写,全局的类型定义都在 `./types` 目录下存放着,可在里面找到相关的数据类型结构。 | ||
|
||
## 模块 | ||
|
||
新版本进行模块化划分,目录为 `./src/modules`。目录下可以存在不同的模块,每个模块管理着的所属业务的 `api`、`types`、`ts`以及`视图文件`。 | ||
|
||
## 插件 | ||
|
||
新版前端中新增了一个 `./src/plugins` 目录,专门存放独立应用或者插件等等。 | ||
|
||
## 别名系统 | ||
在 `vite.config.ts` 文件中定义了以下别名,在引入文件时可使用别名代替全量路径: | ||
|
||
```json vite.config.ts | ||
"resolve": { | ||
"alias": { | ||
'@': path.resolve(__dirname, 'src'), | ||
'#': path.resolve(__dirname, 'types'), | ||
'$': path.resolve(__dirname, 'src/plugins'), | ||
'~': path.resolve(__dirname, 'src/modules'), | ||
}, | ||
}, | ||
``` | ||
|
||
- `@`:代表了 `./src` 目录,一般情况下所有前端项目默认都有此别名。 | ||
- `#`:代表了 `./types` 目录,可方便引入全局类型。 | ||
- `$`: 代表了 `./src/plugins` 目录,可方便快速的引入插件内的文件。 | ||
- `~`: 代表了 `./src/modules` 目录,可方便快速的引入模块内的文件。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 开始 | ||
|
||
::: tip 提示 | ||
以下内容全以源码已经下载好,并在命令行下进入到了 `./web` 目录为前提。 | ||
::: | ||
|
||
## 开发环境 | ||
|
||
需要在本地依次安装好 [Node.js](https://nodejs.org/zh-cn), [pnpm](https://pnpm.io/zh/)。也可以使用 `yarn` 等其他包管理工具,推荐使用 `pnpm`,文档内容以 `pnpm` 为准。 | ||
|
||
- Node.js >= 20.0.0,推荐 20.x.x 的 LTS 版本 | ||
- PNPM >= 9.0.0 | ||
|
||
## 安装依赖及运行 | ||
运行成功后,会自动打开页面,默认地址为 http://localhost:2888 | ||
|
||
```bash | ||
# 安装依赖 | ||
pnpm i 或 pnpm install | ||
|
||
# 运行 | ||
pnpm dev | ||
``` | ||
|
||
::: warning 安装依赖报错 | ||
如果无法正常安装依赖,可能是因为 npm 默认源无法访问, | ||
可以尝试执行 `pnpm config set registry https://registry.npmmirror.com/` | ||
切换为国内 `npmmirror` 镜像源(也可以使用 [nrm](https://github.com/Pana/nrm) 一键切换源), | ||
然后删除根目录下 `/node_modules` 文件夹并重新安装依赖。 | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters