# react2006A **Repository Path**: wangjiepang/react2006-a ## Basic Information - **Project Name**: react2006A - **Description**: react宏业找房111111111 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 8 - **Created**: 2023-03-21 - **Last Updated**: 2023-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # platform-app ## 一、github flow (已经有 pr 暂未审核,但是还需要一个新的 pr,如何实现?) cheery-pick 摘出来一个 commit id ## 二、配置 vis Code 1. 下载 Editor Config 2. .editorconfig ```js # http://editorconfig.org root = true [*] # 表示所有文件适用 charset = utf-8 # 设置文件字符集为 utf-8 indent_style = space # 缩进风格(tab | space) indent_size = 2 # 缩进大小 end_of_line = lf # 控制换行类型(lf | cr | crlf) trim_trailing_whitespace = true # 去除行首的任意空白字符 insert_final_newline = true # 始终在文件末尾插入一个新行 [*.md] # 表示仅 md 文件适用以下规则 max_line_length = off trim_trailing_whitespace = false ``` 3. Prettier- code formatter (用户区) ## 三、git 规范化配置 + eslint `参考文档:https://blog.csdn.net/weixin_47980825/article/details/127473686` ### husky 可以帮助我们在 执行 git commit 提交的时候,按照 eslint 规范进行修复代码。 husky 是一个 git hook 工具,可以帮助我们触发 git 提交的各个阶段:pre-commit、commit-msg、pre-push 支持所有的 Git 钩子 ```js npx husky-init && npm install ``` ### commitizen `定义:是一个帮助我们编写规范 commit message 的工具。` 1. 安装 > npm install commitizen -D 2. 安装 log: cz-conventional-changelog > npx commitizen init cz-conventional-changelog --save-dev --save-exact 3. 安装 commitLint,防止用户跳过不规范提交 > 3. 安装 npm i @commitlint/config-conventional @commitlint/cli -D ```js // commitlint.config.js module.exports = { extends: ['@commitlint/config-conventional'], } ``` ### 通过以上安装,git 提交模式代码如下: ```js // git 提交步骤: npm run cz git pull git push ``` ## 四、 服务器部署 ### 一、项目部署介绍:前后端分离开发 前端:vue npm run build -> dist 目录(html/css/js/images...) -> nginx 服务器的静态服务读取目录下 后端:egg -> npm run dev -> 把代码传到服务器上,执行 -> npm run start 数据库部署: 线上开启一个 mysql 数据库自己可以创建账号密码 ### 二、服务器介绍 1. 阿里云 (推荐)虚拟空间(2g, 1 核心 40g) 2. 腾讯云 3. 华为云 4. 七牛云 ```js // 1. 购物服务器虚拟空间 (选择安装系统 centerOs ubantu) // 2. 给这个虚拟空间安装系统界面和工具(宝塔工具) // 3. 创建数据库mysql // 4. 上传代码(后端,前端) // 5. 部署启动 ``` 外网面板地址: https://47.101.45.245:42595/9e253d29 内网面板地址: https://172.19.115.82:42595/9e253d29 username: ed5yohgs password: 4a31ba72 ## 五、安装 nvm nvm 管理 node 版本的管理器 nvm ls 列举当前所有的 node 版本 nvm install v18 nvm use v16 切换 node 版本号 ## 六、pm2 进程管理 可以让当前的服务在服务器上持续运行 ## 七、上线 1. 前端打包管理 2. 后端进程管理 pm2 ## 八、mysql 连接问题讲解(是否开放端口?)端口开发 3306 默认端口(workBench) https://dev.mysql.com/downloads/workbench/ ## 九、vue3 知识点: 一、vue2 vue3 基本区别 vue2 面条式写法 二、合成 api(composition Api) 提取自定义 hooks 三、优点? 四、mitt 五、 Elment-Plus(1. 全局引入 2. 按需引入) 1. ElementPlus 按需引入(JS 代码默认支持基于 ES modules 的 摇树 tree shaking;) ```js // 引入未使用代码 ``` 2. css 引入 ```js css 代码需要一次性引入 import 'element-plus/dist/index.css' ``` ## 十、vue i18n-> 国际化 功能引入 (internationalization) `https://vue-i18n.intlify.dev/guide/` 1. 安装 npm install vue-i18n@9 2. 新建一个 i18n 配置文件,配置 i18n 功能 ## 十一、vue3 自定义指令开发 ## 十二、egg 代码开发 ## 十四、前端暗夜模式实现 ## 十五、自定义指令(focus, img-load) ## 十七、字体切换 定义:font-face 是 css3 中允许使用自定义字体的一个模块,他主要是把自己定义的 Web 字体嵌入到你的网页中。 ```css /* @font-face { font-family: ; src: [],[ []], *; [font-weight: ]; [font-style: