# docu-sys **Repository Path**: learn_15/docu-sys ## Basic Information - **Project Name**: docu-sys - **Description**: 文案系统vue3+ts - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-03-10 - **Last Updated**: 2025-09-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

Vue3-cli


## Features - ⚡️ [Vue 3](https://github.com/vuejs/core), [Vite 2](https://github.com/vitejs/vite), [pnpm](https://pnpm.io/), [ESBuild](https://github.com/evanw/esbuild) - born with fastness - 🗂 [File based routing](./src/pages) - 📦 [Components auto importing](./src/components) - 🎨 [UnoCSS](https://github.com/antfu/unocss) - The instant on-demand atomic CSS engine. - 😃 Use icons from any icon sets in [Pure CSS](https://github.com/antfu/unocss/tree/main/packages/preset-icons) - 🔥 Use the [new ` ``` ```bash ``` #### eslint tslint 代码规则参考[@antfu/eslint-config](https://github.com/antfu/eslint-config) - Single quotes, no semi - Auto fix for formatting (aimed to be used standalone without Prettier) - TypeScript, Vue, React out-of-box - Lint also for json, yaml, markdown - Sorted imports, dangling commas for cleaner commit diff - Reasonable defaults, best practices, only one-line of config eslint额外规则可在package.json中配置 ```bash "eslintConfig": { "extends": "@antfu", "rules": { "import/no-mutable-exports": [ "error" ], "no-console": "off" } } ``` ts额外规则可在tsconfig.json中配置 #### vue-i18n 官方文档[Vue-i18n](https://kazupon.github.io/vue-i18n/zh/started.html) 语言文件在locales文件夹中编写,采用yml配置 想了解yml配置的可阅读[yml参考文档](https://www.ruanyifeng.com/blog/2016/07/yaml.html) [yml官方文档](https://yaml.org/spec/1.2.2/) ```bash #用法demo ``` #### pinia vue3中尤雨溪推荐使用[pinia](https://pinia.vuejs.org/introduction.html)代替vuex ```bash # demo const useSettingStore = defineStore( // 唯一ID 'settings', { state: () => ({ app: { routeBaseOn: 'fileSystem', }, }), getters: {}, actions: { }, }, ) export default useSettingStore ``` ```bash #.vue文件中使用 ``` #### theme style Element Plus 默认提供一套主题,CSS 命名采用 BEM 的风格,方便使用者覆盖样式 可参考[element-plus主题配置文档](https://element-plus.gitee.io/zh-CN/guide/theming.html) theme-chalk 使用SCSS编写而成。 你可以在 packages/theme-chalk/src/common/var.scss 文件中查找SCSS变量。全部scss变量可查看源代码 [var scss](https://github.com/element-plus/element-plus/blob/dev/packages/theme-chalk/src/common/var.scss) ##### 如何覆盖它? - 如果您的项目也使用了 SCSS,可以直接修改 Element Plus 的样式变量。 新建一个样式文件,例如 styles/element/index.scss: ```bash #// styles/element/index.scss #// 只需要重写你需要的即可 @forward 'element-plus/theme-chalk/src/common/var.scss' with ( $colors: ( 'primary': ( 'base': green, ), ), ); #// 如果只是按需导入,则可以忽略以下内容。 #// 如果你想导入所有样式: #// @use "element-plus/theme-chalk/src/index.scss" as *; ``` 然后在你的项目入口文件中,导入这个样式文件以替换 Element Plus 内置的 CSS: ```bash import { createApp } from 'vue' import './styles/element/index.scss' import ElementPlus from 'element-plus' import App from './App.vue' const app = createApp(App) app.use(ElementPlus) ``` - 如果你正在使用vite,并且你想在按需导入时自定义主题。 使用 scss.additionalData 来编译所有应用 scss 变量的组件。 ```bash // vite.config.ts export default defineConfig({ resolve: { alias: { '~/': `${path.resolve(__dirname, 'src')}/`, }, }, css: { preprocessorOptions: { scss: { additionalData: `@use "~/styles/element/index.scss" as *;`, }, }, }, ``` #### services 基于axios封装通用api [axios官方文档](http://www.axios-js.com/) 所有的api建议放在services内,页面用到时import导入 #### husky lint-staged [husky文档](https://www.breword.com/typicode-husky) [lint-staged文档](https://github.com/okonet/lint-staged) 增加了pre-commit格式检查,不符合lint规定的不能commit,commit完建议查看下是否正确提交 #### git commit 增加了git commit 文本检查,格式参考commitlint.config.js ``` bash git commit -m 'init: your description' 'init', // 初始化 'feat', // 新功能(feature) 'fix', // 修补bug 'docs', // 文档(documentation) 'style', // 格式、样式(不影响代码运行的变动) 'refactor', // 重构(即不是新增功能,也不是修改BUG的代码) 'perf', // 优化相关,比如提升性能、体验 'test', // 添加测试 'build', // 编译相关的修改,对项目构建或者依赖的改动 'ci', // 持续集成修改 'chore', // 构建过程或辅助工具的变动 'revert', // 回滚到上一个版本 'workflow', // 工作流改进 'mod', // 不确定分类的修改 'wip', // 开发中 'types', // 类型修改 'release', // 版本发布 ``` #### env config 默认提供三套环境配置 - 开发环境 .env.development - 测试环境 .env.test - 生产环境 .env.production 开发者可根据实际业务需求进行扩展,如果对这块不熟悉,请阅读 [Vite - 环境变量和模式](https://cn.vitejs.dev/guide/env-and-mode.html) 章节 ``` import.meta.env[key] ``` #### index.html [vite-plugin-html](https://github.com/vbenjs/vite-plugin-html)提供配置index.html的能力,默认配置了 - HTML 压缩能力 - EJS 模版能力 #### unocss [原子化css](https://antfu.me/posts/reimagine-atomic-css-zh) 更方便的使用css类名来定义css样式,同时支持按需加载,不会导致包体积变大 #### Icons You can use icons from almost any icon sets by the power of [Iconify](https://iconify.design/). It will only bundle the icons you use. Check out [unplugin-icons](https://github.com/antfu/unplugin-icons) for more details. [icon地址](https://icones.netlify.app/collection/carbon) 加载icon包,点击icon有使用icon方法。 ```bash #package.json #"@iconify-json/carbon": "^1.1.6",
``` #### ga分析 更多细节可参考[vue-gtag](https://matteo-gabriele.gitbook.io/vue-gtag/auto-tracking) 需要修改配置项中的id ```bash app.use(VueGtag, { config: { id: "GA_MEASUREMENT_ID", #// https://analytics.google.com/ 中的衡量id }, }, router); ``` #### 自动生成组件文档 npm run docs:create -- -t 'D:\code\Document-System\src\components\Page\Page.vue' -t 后面跟着绝对路径,右键复制文件的绝对路径即可 运行组件文档 npm run docs:dev ### apifox npm i @galaxy/apifox-cli -g --registry http://120.79.37.227:4873/ # 更新所有接口 apifox-cli create --type=all # 按文件夹模块更新接口 apifox-cli create --type=module # 按文件夹模块更新接口 --prefixPath参数可以给接口path增加统一的前缀 apifox-cli create --type=module --prefixPath=testPrefix # 按api接口精确更新 apifox-cli create --type=api