diff --git a/water-admin/README.md b/water-admin/README.md index c300135..1116853 100644 --- a/water-admin/README.md +++ b/water-admin/README.md @@ -1,75 +1,61 @@ -# React + TypeScript + Vite +# water-admin -This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. +基于 **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/) +* Node.js **24.15.0** 或更高版本 -## 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... - }, - }, -]) +### 1. 安装依赖 +```bash +npm install ``` -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' - -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... - }, - }, -]) +### 2. 启动开发服务器 +```bash +npm run dev ``` + +启动成功后将看到类似输出: + +```text +VITE v8.1.3 ready in 233 ms + +➜ Local: http://localhost:5173/ +➜ Network: use --host to expose +➜ press h + enter to show help +``` + +打开浏览器访问: + +```text +http://localhost:5173/ +``` + +## 项目构建 + +执行: + +```bash +npm run build +``` + +构建完成后,生成的静态文件位于: + +```text +dist/ +``` + +## 本地预览 + +执行: + +```bash +npm run preview +``` + +该命令会启动一个本地服务器,用于预览构建后的项目效果。