Skip to content

Commit c3f3fee

Browse files
committed
添加 基础框架
1 parent bc48942 commit c3f3fee

File tree

155 files changed

+38201
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+38201
-2
lines changed

.editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
end_of_line = lf
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*.md]
13+
insert_final_newline = false
14+
trim_trailing_whitespace = false

.env

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# title
2+
VITE_APP_TITLE = uni-app Vue3

.env.development

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 本地环境
2+
ENV = 'development'
3+
4+
VITE_BASE = '/api'
5+
6+
# Whether to open mock
7+
VITE_USE_MOCK = true
8+
9+
10+
# 本地环境接口地址
11+
# VITE_API_URL = 'http://localhost:8000'
12+
VITE_API_URL = ''
13+
14+
15+
VITE_PORT = 3000
16+
17+
# BASE_URL
18+
VITE_BASE_URL = https://api-catch.ranesuangyu.top
19+
20+
# 上传域名
21+
VITE_UPLOAD_URL = /upload
22+

.env.production

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 线上环境
2+
ENV = 'production'
3+
4+
VITE_BASE = '/api'
5+
6+
VITE_NODE_ENV='production'
7+
8+
VITE_USE_CHUNK_MOCK = false
9+
10+
# 线上环境接口地址
11+
VITE_API_URL = 'http://prod.xxx.com'

.env.staging

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 线上环境
2+
ENV = 'production'
3+
4+
VITE_BASE = '/api'
5+
6+
VITE_NODE_ENV='staging'
7+
8+
VITE_USE_CHUNK_MOCK = false
9+
10+
# 线上环境接口地址
11+
VITE_API_URL = 'http://test.xxx.com'

.eslintignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# eslint 忽略检查
2+
node_modules
3+
dist
4+
.idea
5+
.vscode
6+
.hbuilderx
7+
src/manifest.json
8+
src/pages.json
9+
src/tmui/
10+
*.sh
11+
node_modules
12+
*.md
13+
*.woff
14+
*.ttf
15+
*.yaml
16+
dist
17+
/public
18+
/docs
19+
.husky
20+
.local
21+
/bin

.eslintrc.js

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
es2021: true,
5+
},
6+
parser: 'vue-eslint-parser',
7+
extends: [
8+
'plugin:@typescript-eslint/recommended',
9+
'plugin:vue/vue3-essential',
10+
'prettier',
11+
],
12+
parserOptions: {
13+
ecmaVersion: 'latest',
14+
parser: '@typescript-eslint/parser',
15+
sourceType: 'module',
16+
},
17+
settings: {
18+
'import/resolver': {
19+
alias: {
20+
map: [['@', './src']],
21+
extensions: ['.ts', '.js', '.jsx', '.json', '.vue'],
22+
},
23+
},
24+
},
25+
plugins: ['vue', '@typescript-eslint', 'prettier'],
26+
rules: {
27+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
28+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
29+
'no-var': 'error',
30+
'prettier/prettier': 'error',
31+
'vue/no-multiple-template-root': 'off',
32+
'no-mutating-props': 'off',
33+
'vue/no-v-html': 'off',
34+
// @fixable 必须使用单引号,禁止使用双引号
35+
quotes: [
36+
'error',
37+
'single',
38+
{
39+
avoidEscape: true,
40+
allowTemplateLiterals: true,
41+
},
42+
],
43+
// 结尾必须有分号;
44+
semi: [
45+
'error',
46+
'always',
47+
{
48+
omitLastInOneLineBlock: true,
49+
},
50+
],
51+
'vue/script-setup-uses-vars': 'error',
52+
'@typescript-eslint/ban-ts-ignore': 'off',
53+
'@typescript-eslint/explicit-function-return-type': 'off',
54+
'@typescript-eslint/no-explicit-any': 'off',
55+
'@typescript-eslint/no-var-requires': 'off',
56+
'@typescript-eslint/no-empty-function': 'off',
57+
'vue/custom-event-name-casing': 'off',
58+
'no-use-before-define': 'off',
59+
'@typescript-eslint/no-use-before-define': 'off',
60+
'@typescript-eslint/ban-ts-comment': 'off',
61+
'@typescript-eslint/ban-types': 'off',
62+
'@typescript-eslint/no-non-null-assertion': 'off',
63+
'@typescript-eslint/explicit-module-boundary-types': 'off',
64+
'@typescript-eslint/no-unused-vars': [
65+
'warn',
66+
{
67+
argsIgnorePattern: '^_',
68+
varsIgnorePattern: '^_',
69+
},
70+
],
71+
'no-unused-vars': [
72+
'warn',
73+
{
74+
argsIgnorePattern: '^_',
75+
varsIgnorePattern: '^_',
76+
},
77+
],
78+
'space-before-function-paren': 'off',
79+
'vue/attributes-order': 'off',
80+
'vue/v-on-event-hyphenation': 'off',
81+
'vue/multi-word-component-names': 'off',
82+
'vue/one-component-per-file': 'off',
83+
'vue/html-closing-bracket-newline': 'off',
84+
'vue/max-attributes-per-line': 'off',
85+
'vue/multiline-html-element-content-newline': 'off',
86+
'vue/singleline-html-element-content-newline': 'off',
87+
'vue/attribute-hyphenation': 'off',
88+
'vue/require-default-prop': 'off',
89+
},
90+
globals: {
91+
defineProps: 'readonly',
92+
defineEmits: 'readonly',
93+
defineExpose: 'readonly',
94+
withDefaults: 'readonly',
95+
uni: 'readonly',
96+
},
97+
};

.gitignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.DS_Store
2+
node_modules/
3+
unpackage/
4+
dist/
5+
dist-ssr/
6+
7+
# local env files
8+
# *.local
9+
.env.local
10+
.env.*.local
11+
12+
# Log files
13+
# logs
14+
# *.log
15+
npm-debug.log*
16+
yarn-debug.log*
17+
yarn-error.log*
18+
pnpm-debug.log*
19+
lerna-debug.log*
20+
21+
# Editor directories and files
22+
.project
23+
.idea
24+
.vscode
25+
*.suo
26+
*.ntvs*
27+
*.njsproj
28+
*.sln
29+
*.sw*
30+
.hbuilderx
31+
# 要提交 .env 来确保 jit v2 的开发 watch mode
32+
!.env
33+
34+
src/ignore

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
npx lint-staged

.npmrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
2+
registry=https://registry.npm.taobao.org
3+
4+
# pnpm
5+
strict-peer-dependencies=false

.prettierignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# 忽略格式化文件
2+
node_modules
3+
dist
4+
.idea
5+
.vscode
6+
.hbuilderx
7+
src/manifest.json
8+
src/pages.json
9+
*.sh
10+
node_modules
11+
*.md
12+
*.woff
13+
*.ttf
14+
*.yaml
15+
dist
16+
/public
17+
/docs
18+
.husky
19+
.local
20+
/bin

.prettierrc.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/prettier'],
3+
printWidth: 80, // 一行的字符数,如果超过会进行换行,默认为80
4+
semi: true, // 行尾是否使用分号,默认为true
5+
vueIndentScriptAndStyle: true,
6+
singleQuote: true, // 字符串是否使用单引号,默认为 false,使用双引号
7+
trailingComma: 'all', // 是否使用尾逗号
8+
proseWrap: 'never',
9+
htmlWhitespaceSensitivity: 'strict',
10+
endOfLine: 'auto',
11+
arrowParens: 'avoid',
12+
};

README.md

+128-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,128 @@
1-
# uniapp-vue3-ts-template
2-
uni-app-vue3-template
1+
uni-app Vue3 Vite3 Pinia TypeScript 基础框架
2+
===
3+
4+
## 特性
5+
6+
- **最新技术栈**:使用 Vue3/Vite3/Pinia/TypeScript 等前端前沿技术开发;
7+
- **Eslint/Prettier**:规范代码格式,统一编码;
8+
- **路由拦截**:基于 uni.addInterceptor 进行路由拦截;
9+
- **请求拦截**:核心使用 [luch-request](https://github.com/lei-mu/luch-request),支持请求和响应拦截等;
10+
- **缓存加密**:使用AES加密缓存,可设置区分在开发或生成环境中是否加密;
11+
12+
## 目录结构
13+
14+
```shell
15+
├── src
16+
│ ├── api # 接口相关
17+
│ │ ├── model # 数据模型
18+
│ │ ├── auth.ts
19+
│ │ └── ...
20+
│ ├── components # 组件目录
21+
│ │ ├── AppProvider
22+
│ │ └── ...
23+
│ ├── config # 配置相关
24+
│ │ ├── app.ts
25+
│ │ └── encryptionConfig.ts
26+
│ ├── enums # 枚举/常量
27+
│ │ ├── appEnum.ts
28+
│ │ └── ...
29+
│ ├── language # i18n
30+
│ │ ├── lang
31+
│ │ └── index.ts
32+
│ ├── pages # 页面
33+
│ │ ├── about
34+
│ │ └── ...
35+
│ ├── pagesA # 子页面(拆包)
36+
│ │ └── list
37+
│ ├── state # 状态管理模式(pinia stores)
38+
│ │ ├── modules
39+
│ │ └── index.ts
40+
│ ├── static # 静态文件静态公共文件
41+
│ │ ├── images
42+
│ │ └── ...
43+
│ ├── types # 类型文件
44+
│ ├── uni_modules # uni 组件库
45+
│ ├── utils # 工具类
46+
│ │ ├── cache # 缓存相关目录
47+
│ │ ├── http # request相关目录
48+
│ │ ├── interceptors # 拦截器相关目录
49+
│ │ └── ...
50+
│ ├── wxcomponents # 微信小程序组件
51+
│ ├── App.vue
52+
│ ├── env.d.ts
53+
│ ├── main.ts
54+
│ ├── manifest.json
55+
│ ├── pages.json
56+
│ └── uni.scss
57+
├── .editorconfig
58+
├── .env
59+
├── .env.development
60+
├── .env.production
61+
├── .env.staging
62+
├── .eslintignore
63+
├── .eslintrc.js
64+
├── .gitignore
65+
├── .npmrc
66+
├── .prettierignore
67+
├── .prettierrc.js
68+
├── LICENSE
69+
├── README.md
70+
├── favicon.ico
71+
├── index.html
72+
├── package-lock.json
73+
├── package.json
74+
├── tsconfig.json
75+
└── vite.config.ts
76+
77+
```
78+
79+
## 安装使用
80+
81+
- 安装依赖
82+
83+
```bash
84+
pnpm install
85+
```
86+
87+
- 运行
88+
89+
```bash
90+
# 其他端请查看 package.json script
91+
pnpm dev:h5
92+
```
93+
94+
- 打包
95+
96+
```bash
97+
# 其他端请查看 package.json script
98+
pnpm build:h5
99+
```
100+
101+
## Git 提交规范
102+
103+
- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular))
104+
105+
- `feat` 增加新功能
106+
- `fix` 修复问题/BUG
107+
- `style` 代码风格相关无影响运行结果的
108+
- `perf` 优化/性能提升
109+
- `refactor` 重构
110+
- `revert` 撤销修改
111+
- `test` 测试相关
112+
- `docs` 文档/注释
113+
- `chore` 依赖更新/脚手架配置修改等
114+
- `workflow` 工作流改进
115+
- `ci` 持续集成
116+
- `types` 类型定义文件更改
117+
- `wip` 开发中
118+
119+
## 参考资料
120+
121+
- [uni-app Vue3 Vite3 TypeScript 基础框架](https://gitee.com/h_mo/uniapp-vue3-vite3-ts-template) - 基于该项目进行修改
122+
- [uni-app](https://github.com/dcloudio/uni-app) - 跨平台框架
123+
- [Vue3](https://github.com/vuejs/) - Vue3
124+
- [Vite](https://github.com/vitejs/vite) - 构建工具
125+
- [Pinia](https://github.com/vuejs/pinia) - 状态管理(代替 Vuex)
126+
- [TypeScript](https://github.com/microsoft/TypeScript) - TS
127+
- [luch-request](https://github.com/lei-mu/luch-request) - API 请求库
128+
-

favicon.ico

16.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)