docs(web): localize web README to Chinese
This commit is contained in:
+46
-62
@@ -1,73 +1,57 @@
|
||||
# React + TypeScript + Vite
|
||||
# TodoList Web 前端
|
||||
|
||||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
||||
这是 TodoList 的用户端前端应用(SPA + PWA),基于 `React + TypeScript + Vite`。
|
||||
|
||||
Currently, two official plugins are available:
|
||||
## 技术栈
|
||||
|
||||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
|
||||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
|
||||
- React
|
||||
- TypeScript
|
||||
- Vite
|
||||
- Tailwind CSS
|
||||
- shadcn/ui
|
||||
|
||||
## React Compiler
|
||||
## 本地开发
|
||||
|
||||
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
||||
在仓库根目录执行:
|
||||
|
||||
## Expanding the ESLint configuration
|
||||
|
||||
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
||||
|
||||
```js
|
||||
export default defineConfig([
|
||||
globalIgnores(["dist"]),
|
||||
{
|
||||
files: ["**/*.{ts,tsx}"],
|
||||
extends: [
|
||||
// Other configs...
|
||||
|
||||
// Remove tseslint.configs.recommended and replace with this
|
||||
tseslint.configs.recommendedTypeChecked,
|
||||
// Alternatively, use this for stricter rules
|
||||
tseslint.configs.strictTypeChecked,
|
||||
// Optionally, add this for stylistic rules
|
||||
tseslint.configs.stylisticTypeChecked
|
||||
|
||||
// Other configs...
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
|
||||
tsconfigRootDir: import.meta.dirname
|
||||
}
|
||||
// other options...
|
||||
}
|
||||
}
|
||||
]);
|
||||
```bash
|
||||
pnpm install
|
||||
pnpm --filter web dev
|
||||
```
|
||||
|
||||
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
||||
默认开发地址:
|
||||
|
||||
```js
|
||||
// eslint.config.js
|
||||
import reactX from "eslint-plugin-react-x";
|
||||
import reactDom from "eslint-plugin-react-dom";
|
||||
- `http://localhost:5173`
|
||||
|
||||
export default defineConfig([
|
||||
globalIgnores(["dist"]),
|
||||
{
|
||||
files: ["**/*.{ts,tsx}"],
|
||||
extends: [
|
||||
// Other configs...
|
||||
// Enable lint rules for React
|
||||
reactX.configs["recommended-typescript"],
|
||||
// Enable lint rules for React DOM
|
||||
reactDom.configs.recommended
|
||||
],
|
||||
languageOptions: {
|
||||
parserOptions: {
|
||||
project: ["./tsconfig.node.json", "./tsconfig.app.json"],
|
||||
tsconfigRootDir: import.meta.dirname
|
||||
}
|
||||
// other options...
|
||||
}
|
||||
}
|
||||
]);
|
||||
## 后端接口地址
|
||||
|
||||
前端默认请求:
|
||||
|
||||
- `http://localhost:3000`
|
||||
|
||||
如需自定义,请在运行前设置环境变量:
|
||||
|
||||
```bash
|
||||
VITE_API_BASE_URL=http://localhost:3000
|
||||
```
|
||||
|
||||
## 构建与预览
|
||||
|
||||
```bash
|
||||
pnpm --filter web build
|
||||
pnpm --filter web preview
|
||||
```
|
||||
|
||||
## 当前功能进度(阶段性)
|
||||
|
||||
- 邮箱验证码登录页面
|
||||
- OAuth 回调页面
|
||||
- 会话本地缓存与启动恢复
|
||||
- 基础工作台页面骨架
|
||||
|
||||
## 目录说明
|
||||
|
||||
- `src/pages`:页面组件
|
||||
- `src/components`:通用 UI 组件
|
||||
- `src/services`:接口请求与会话处理
|
||||
- `src/lib`:工具函数
|
||||
|
||||
Reference in New Issue
Block a user