From 177f950c51d9f129cf2df56a20e86ee3fa32b8c1 Mon Sep 17 00:00:00 2001 From: anyfork <874957743@qq.com> Date: Sat, 22 Jul 2023 22:18:53 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20feat(router):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=AE=80=E5=8D=95=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加路由示例 首页loading 更新docs --- .eslintignore | 1 + .eslintrc.cjs | 6 +- README.md | 52 ++--- index.html | 5 +- src/App.vue | 40 ++-- src/{ => assets}/style.css | 0 src/assets/svg/no-permission.svg | 313 --------------------------- src/components/common/AppLoading.vue | 18 ++ src/main.ts | 8 +- src/router/index.ts | 3 +- src/router/modules/home.ts | 8 + src/router/modules/index.ts | 11 + src/types/components.d.ts | 9 +- src/{ => types}/vite-env.d.ts | 0 src/views/index.vue | 29 +++ 15 files changed, 121 insertions(+), 382 deletions(-) rename src/{ => assets}/style.css (100%) delete mode 100644 src/assets/svg/no-permission.svg create mode 100644 src/components/common/AppLoading.vue create mode 100644 src/router/modules/home.ts create mode 100644 src/router/modules/index.ts rename src/{ => types}/vite-env.d.ts (100%) create mode 100644 src/views/index.vue diff --git a/.eslintignore b/.eslintignore index 47e3d3b..3278083 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,3 +7,4 @@ node_modules dist public .husky +index.html diff --git a/.eslintrc.cjs b/.eslintrc.cjs index da68c16..ba4f88f 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -37,6 +37,10 @@ module.exports = { // 关闭ts声明的方法之前的空格校验 '@typescript-eslint/space-before-function-paren': 'off', // 关闭ts类型单行和多行结尾分隔符 - '@typescript-eslint/member-delimiter-style': 'off' + '@typescript-eslint/member-delimiter-style': 'off', + // 关闭组件以单个单次命名限制 + 'vue/multi-word-component-names': 'off', + // 关闭强制布尔表达式 + '@typescript-eslint/strict-boolean-expressions': 'off' } } diff --git a/README.md b/README.md index 1a7e49e..125dbe8 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ 一直以来,每次采用`vite`搭建`Vue3`项目时,都苦于配置`Eslint`代码校验规范,网上的水贴层出不穷,你抄我的,我粘贴你的,没有几个是有用的,不仅容易误导他人,还浪费大量的时间排查问题。最近花了一些时间,查阅了很多资料,自己也通过反复验证,决定自己搭建一个简单的模板,集成好日常代码开发规范和提交规范,把常用 的`Vite`插件都配置好,在以后创建项目时直接使用,避免重复造轮子,同时也供他人参考。 -这是一个基于Vite4.X + Vue3.X + TypeScript + Pinia + Naive UI + Unocss + Eslint + Prettier + husky + lint-staged + commitlint + commitizen+ cz-customizable + conventional-changelog 构建的标准的Vue3项目模板。整个项目包依赖采用`pnpm`进行依赖管理,`Node`版本为16.17.0, 同时也集成了项目中常用的插件,包含组件自动导入API +这是一个基于Vite4.X+Vue3.X+TypeScript+Naive UI+Pinina+VueRouter+Unocss+Eslint+Prettier+husky+lint-staged+commitlint+commitizen+cz-customizable+conventional-changelog构建的标准的vue项目模板。整个项目包依赖采用`pnpm`进行依赖管理,`Node`版本为16.17.0, 同时也集成了项目中常用的插件,包含组件自动导入API ## 二 项目创建 @@ -148,7 +148,6 @@ export default defineConfig(){ inject: { data: { title: env.VITE_SYSTEM_TITLE, - loading: env.VITE_SYSTEM_LOADING, description: env.VITE_SYSTEM_DESC } } @@ -159,46 +158,27 @@ export default defineConfig(){ ``` `inject`中的data就是要注入的变量参数,`env`为环境变量参数。可以通过一下代码获取到: ```ts +import { loadEnv } from 'vite' const env = loadEnv(mode, process.cwd()) -const { VITE_ICON_PREFFIX, VITE_ICON_LOCAL_PREFFIX } = env ``` 2 修改`index.html`文件,将`vite-plugin-html`插件注入的数据,通过`ejs`语法写入`index.html`,如下: ```html - + - -
- - - - - -