Browse Source

👣 重构底层

master
wangxiang 3 years ago
parent
commit
d8c0335500
  1. 19
      kicc-ui/README.md
  2. 8
      kicc-ui/package.json

19
kicc-ui/README.md

@ -30,15 +30,28 @@ kicc-ui 是基于vben Admin的模板开发,使用了最新的`vue3`,`vite2`,`T @@ -30,15 +30,28 @@ kicc-ui 是基于vben Admin的模板开发,使用了最新的`vue3`,`vite2`,`T
- [Mock.js](https://github.com/nuysoft/Mock) - mockjs 基本语法
## 🍀 需要注意的地方
- hooks目录: 基于Vue3-Composition-API二次封装的使用实用程序的组合api,目的为了扩展@vueuse/core组合api
- utils目录: 二次封装,或原生写的工具类,不会去使用一些框架的钩子
##1.钩子工具跟项目基础工具区别
- **hooks目录: 基于Vue3-Composition-API二次封装的使用实用程序的组合api,目的为了扩展@vueuse/core组合api**
- **utils目录: 二次封装,或原生写的工具类,不会去使用一些框架的钩子**
```bash
两者的区别:
可以理解为两者都是工具,但是区别在于utils目录没有使用Vue3-Composition-API封装,
hooks目录使用了Vue3-Composition-API,hooks目录说的在明白一点就是在扩展自己的Vue3-Composition-API
```
Vue3-Composition-API官方介绍: https://staging-cn.vuejs.org/guide/extras/composition-api-faq.html
**Vue3-Composition-API官方介绍: https://staging-cn.vuejs.org/guide/extras/composition-api-faq.html**
#2.打包前应该如何执行typescript类型检查
- **vite是不支持typescript类型检查,因为没必要,现在的开发工具都是支持eslint的,让开发工具接管类型检查就行啦**
- **vite官网TypeScript介绍:https://vitejs.bootcss.com/guide/features.html#typescript**
- **注意:既然vite不支持typescript类型检查,那我们就应该要在发布编译阶段手动检查类型,要不然完全体现不出typescript在项目中的作用,使用了typescript就应该要检查代码是否符合类型规范**
```bash
目前项目中有两者打包前检查方案
vue-tsc: 不推荐使用,当前项目vue模板中很多组件库对类型的定义似乎不是那么完整,列如
```
编译打包前类信息 type:check
## 🗽 启动项目

8
kicc-ui/package.json

@ -9,18 +9,18 @@ @@ -9,18 +9,18 @@
},
"scripts": {
"dev": "vite",
"lint:eslint": "eslint --cache --max-warnings 0 \"src/**/*.{vue,ts,tsx}\" --fix",
"build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts",
"build:test": "vite build --mode test && esno ./build/script/postBuild.ts",
"build:no-cache": "yarn delete:cache && yarn run build",
"report": "cross-env REPORT=true yarn run build",
"type:check": "vue-tsc --noEmit --skipLibCheck",
"preview": "yarn run build && vite preview",
"preview:dist": "vite preview",
"report": "cross-env REPORT=true yarn run build",
"log": "conventional-changelog -p angular -i CHANGELOG.md -s",
"delete:lib": "rimraf node_modules",
"delete:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite",
"lint:eslint": "eslint --cache --max-warnings 0 \"src/**/*.{vue,ts,tsx}\" --fix",
"gen:icon": "esno ./build/generate/icon/index.ts"
"gen:icon": "esno ./build/generate/icon/index.ts",
"type:check": "vue-tsc --noEmit --skipLibCheck"
},
"dependencies": {
"@iconify/iconify": "2.2.1",

Loading…
Cancel
Save