├── .gitignore
├── .vscode
├── extensions.json
└── settings.json
├── LICENSE
├── README.md
├── eslint.config.js
├── index.html
├── package.json
├── project.config.json
├── project.private.config.json
├── src
├── App.vue
├── main.ts
├── manifest.json
├── pages.json
├── pages
│ └── index
│ │ └── index.vue
├── static
│ └── logo.png
├── store
│ ├── index.ts
│ └── modules
│ │ └── foo
│ │ └── index.ts
├── types
│ ├── auto-imports.d.ts
│ ├── env.d.ts
│ └── shims-uni.d.ts
└── uni.scss
├── taze.config.js
├── tsconfig.json
├── unocss.config.ts
├── vite.config.ts
└── vite
└── plugins
├── auto-import.ts
└── index.ts
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 |
3 | .DS_Store
4 | node_modules/
5 | dist/
6 | npm-debug.log*
7 | yarn-debug.log*
8 | yarn-error.log*
9 | **/*.log
10 |
11 | tests/**/coverage/
12 | tests/e2e/reports
13 | selenium-debug.log
14 |
15 | # Editor directories and files
16 | .idea
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.local
22 |
23 | package-lock.json
24 | yarn.lock
25 | pnpm-lock.yaml
26 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "vue.volar",
4 | "esbenp.prettier-vscode",
5 | "dbaeumer.vscode-eslint",
6 | "antfu.unocss",
7 | "streetsidesoftware.code-spell-checker"
8 | ]
9 | }
10 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | // Enable the ESlint flat config support
3 | "eslint.experimental.useFlatConfig": true,
4 |
5 | // Disable the default formatter, use eslint instead
6 | "prettier.enable": false,
7 | "editor.formatOnSave": false,
8 |
9 | // Auto fix
10 | "editor.codeActionsOnSave": {
11 | "source.fixAll.eslint": "explicit",
12 | "source.organizeImports": "never"
13 | },
14 |
15 | // Silent the stylistic rules in you IDE, but still auto fix them
16 | "eslint.rules.customizations": [
17 | { "rule": "style/*", "severity": "off" },
18 | { "rule": "format/*", "severity": "off" },
19 | { "rule": "*-indent", "severity": "off" },
20 | { "rule": "*-spacing", "severity": "off" },
21 | { "rule": "*-spaces", "severity": "off" },
22 | { "rule": "*-order", "severity": "off" },
23 | { "rule": "*-dangle", "severity": "off" },
24 | { "rule": "*-newline", "severity": "off" },
25 | { "rule": "*quotes", "severity": "off" },
26 | { "rule": "*semi", "severity": "off" }
27 | ],
28 |
29 | // Enable eslint for all supported languages
30 | "eslint.validate": [
31 | "javascript",
32 | "javascriptreact",
33 | "typescript",
34 | "typescriptreact",
35 | "vue",
36 | "html",
37 | "markdown",
38 | "json",
39 | "jsonc",
40 | "yaml",
41 | "toml"
42 | ],
43 | "cSpell.words": [
44 | "Weapp"
45 | ]
46 | }
47 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 ryan
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 🚀 uniapp-unocss-starter
2 |
3 | 一个 uniapp 精简快速开始模版,使用 uniapp + vue3 + typescript + unocss
4 |
5 | [](https://github.com/antfu/eslint-config)
6 |
7 | ## 特性
8 |
9 | - 整合 [unocss](https://github.com/unocss/unocss) 作为 css 框架
10 |
11 | - 整合 [unplugin-auto-import](https://github.com/antfu/unplugin-auto-import) 自动导入 API
12 |
13 | - 整合 [unocss-preset-weapp](https://github.com/MellowCo/unocss-preset-weapp) 做类名转换
14 |
15 | - 使用 [@antfu/eslint-config](https://github.com/antfu/eslint-config) 作为基础配置,用户可根据需求自行修改
16 |
17 | - 使用 simple-git-hooks + lint-staged 拦截 git 提交并检查代码
18 |
19 | ## 在本地运行
20 |
21 | Clone 这个 project
22 |
23 | ```bash
24 | git clone git@github.com:DimplesY/uniapp-unocss-starter.git
25 |
26 | # or 使用项目作为模版
27 |
28 | npx degit git@github.com:DimplesY/uniapp-unocss-starter.git my-project
29 | ```
30 |
31 | 前往项目目录
32 |
33 | ```bash
34 | cd my-project
35 | ```
36 |
37 | 安装依赖
38 |
39 | ```bash
40 | pnpm install
41 | ```
42 |
43 | 启动项目
44 |
45 | - 微信小程序,可以使用下面命令启动,其他平台可查看 package.json 中的 scripts
46 |
47 | ```bash
48 | pnpm dev:mp-weixin
49 | ```
50 |
--------------------------------------------------------------------------------
/eslint.config.js:
--------------------------------------------------------------------------------
1 | const antfu = require('@antfu/eslint-config').default
2 |
3 | module.exports = antfu({
4 | unocss: true,
5 | formatters: true,
6 | })
7 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "uniapp-unocss-starter",
3 | "type": "commonjs",
4 | "version": "0.0.2",
5 | "scripts": {
6 | "dev:app": "uni -p app",
7 | "dev:custom": "uni -p",
8 | "dev:h5": "uni",
9 | "dev:h5:ssr": "uni --ssr",
10 | "dev:mp-alipay": "uni -p mp-alipay",
11 | "dev:mp-baidu": "uni -p mp-baidu",
12 | "dev:mp-kuaishou": "uni -p mp-kuaishou",
13 | "dev:mp-lark": "uni -p mp-lark",
14 | "dev:mp-qq": "uni -p mp-qq",
15 | "dev:mp-toutiao": "uni -p mp-toutiao",
16 | "dev:mp-weixin": "uni -p mp-weixin",
17 | "dev:quickapp-webview": "uni -p quickapp-webview",
18 | "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei",
19 | "dev:quickapp-webview-union": "uni -p quickapp-webview-union",
20 | "build:app": "uni build -p app",
21 | "build:custom": "uni build -p",
22 | "build:h5": "uni build",
23 | "build:h5:ssr": "uni build --ssr",
24 | "build:mp-alipay": "uni build -p mp-alipay",
25 | "build:mp-baidu": "uni build -p mp-baidu",
26 | "build:mp-kuaishou": "uni build -p mp-kuaishou",
27 | "build:mp-lark": "uni build -p mp-lark",
28 | "build:mp-qq": "uni build -p mp-qq",
29 | "build:mp-toutiao": "uni build -p mp-toutiao",
30 | "build:mp-weixin": "uni build -p mp-weixin",
31 | "build:quickapp-webview": "uni build -p quickapp-webview",
32 | "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
33 | "build:quickapp-webview-union": "uni build -p quickapp-webview-union",
34 | "lint": "eslint .",
35 | "lint:fix": "eslint . --fix",
36 | "up": "taze major -I",
37 | "release": "bumpp",
38 | "postinstall": "npx simple-git-hooks"
39 | },
40 | "dependencies": {
41 | "@dcloudio/uni-app": "3.0.0-alpha-4060320250423001",
42 | "@dcloudio/uni-app-harmony": "3.0.0-alpha-4060320250423001",
43 | "@dcloudio/uni-app-plus": "3.0.0-alpha-4060320250423001",
44 | "@dcloudio/uni-components": "3.0.0-alpha-4060320250423001",
45 | "@dcloudio/uni-h5": "3.0.0-alpha-4060320250423001",
46 | "@dcloudio/uni-mp-alipay": "3.0.0-alpha-4060320250423001",
47 | "@dcloudio/uni-mp-baidu": "3.0.0-alpha-4060320250423001",
48 | "@dcloudio/uni-mp-harmony": "3.0.0-alpha-4060320250423001",
49 | "@dcloudio/uni-mp-jd": "3.0.0-alpha-4060320250423001",
50 | "@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-4060320250423001",
51 | "@dcloudio/uni-mp-lark": "3.0.0-alpha-4060320250423001",
52 | "@dcloudio/uni-mp-qq": "3.0.0-alpha-4060320250423001",
53 | "@dcloudio/uni-mp-toutiao": "3.0.0-alpha-4060320250423001",
54 | "@dcloudio/uni-mp-weixin": "3.0.0-alpha-4060320250423001",
55 | "@dcloudio/uni-mp-xhs": "3.0.0-alpha-4060320250423001",
56 | "@dcloudio/uni-quickapp-webview": "3.0.0-alpha-4060320250423001",
57 | "pinia": "2.0.33",
58 | "vue": "^3.4.21",
59 | "vue-i18n": "^9.1.9"
60 | },
61 | "devDependencies": {
62 | "@antfu/eslint-config": "^2.27.1",
63 | "@dcloudio/types": "^3.4.8",
64 | "@dcloudio/uni-automator": "3.0.0-alpha-4060320250423001",
65 | "@dcloudio/uni-cli-shared": "3.0.0-alpha-4060320250423001",
66 | "@dcloudio/uni-stacktracey": "3.0.0-alpha-4060320250423001",
67 | "@dcloudio/vite-plugin-uni": "3.0.0-alpha-4060320250423001",
68 | "@types/node": "^22.5.0",
69 | "@unocss/eslint-plugin": "^0.62.2",
70 | "@vue/runtime-core": "^3.4.21",
71 | "@vue/tsconfig": "^0.5.1",
72 | "bumpp": "^9.5.2",
73 | "eslint": "^9.9.0",
74 | "eslint-plugin-format": "^0.1.2",
75 | "lint-staged": "^15.2.9",
76 | "simple-git-hooks": "^2.11.1",
77 | "taze": "^0.16.6",
78 | "typescript": "^5.5.4",
79 | "unocss": "^0.62.2",
80 | "unocss-preset-weapp": "^0.62.0",
81 | "unplugin-auto-import": "^0.18.2",
82 | "unplugin-vue-components": "^0.27.4",
83 | "vite": "^5.2.8"
84 | },
85 | "simple-git-hooks": {
86 | "pre-commit": "pnpm lint-staged"
87 | },
88 | "lint-staged": {
89 | "*": "eslint --fix"
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "appid": "wx8c86907a4132bea8",
3 | "compileType": "miniprogram",
4 | "libVersion": "2.26.0",
5 | "packOptions": {
6 | "ignore": [],
7 | "include": []
8 | },
9 | "setting": {
10 | "coverView": true,
11 | "es6": true,
12 | "postcss": true,
13 | "minified": true,
14 | "enhance": true,
15 | "showShadowRootInWxmlPanel": true,
16 | "packNpmRelationList": [],
17 | "babelSetting": {
18 | "ignore": [],
19 | "disablePlugins": [],
20 | "outputPath": ""
21 | }
22 | },
23 | "condition": {},
24 | "editorSetting": {
25 | "tabIndent": "insertSpaces",
26 | "tabSize": 2
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/project.private.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3 | "projectname": "uniapp-unocss-starter",
4 | "setting": {
5 | "compileHotReLoad": true
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | import { createSSRApp } from 'vue'
2 | import * as Pinia from 'pinia'
3 | import 'uno.css'
4 |
5 | import App from './App.vue'
6 |
7 | export function createApp() {
8 | const app = createSSRApp(App)
9 | app.use(Pinia.createPinia())
10 | return {
11 | app,
12 | Pinia,
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "",
3 | "appid": "",
4 | "description": "",
5 | "versionName": "1.0.0",
6 | "versionCode": "100",
7 | "transformPx": false,
8 | /* 5+App特有相关 */
9 | "app-plus": {
10 | "usingComponents": true,
11 | "nvueStyleCompiler": "uni-app",
12 | "compilerVersion": 3,
13 | "splashscreen": {
14 | "alwaysShowBeforeRender": true,
15 | "waiting": true,
16 | "autoclose": true,
17 | "delay": 0
18 | },
19 | /* 模块配置 */
20 | "modules": {},
21 | /* 应用发布信息 */
22 | "distribute": {
23 | /* android打包配置 */
24 | "android": {
25 | "permissions": [
26 | "",
27 | "",
28 | "",
29 | "",
30 | "",
31 | "",
32 | "",
33 | "",
34 | "",
35 | "",
36 | "",
37 | "",
38 | "",
39 | "",
40 | ""
41 | ]
42 | },
43 | /* ios打包配置 */
44 | "ios": {},
45 | /* SDK配置 */
46 | "sdkConfigs": {}
47 | }
48 | },
49 | /* 快应用特有相关 */
50 | "quickapp": {},
51 | /* 小程序特有相关 */
52 | "mp-weixin": {
53 | "appid": "",
54 | "setting": {
55 | "urlCheck": false
56 | },
57 | "usingComponents": true
58 | },
59 | "mp-alipay": {
60 | "usingComponents": true
61 | },
62 | "mp-baidu": {
63 | "usingComponents": true
64 | },
65 | "mp-toutiao": {
66 | "usingComponents": true
67 | },
68 | "uniStatistics": {
69 | "enable": false
70 | },
71 | "vueVersion": "3"
72 | }
73 |
--------------------------------------------------------------------------------
/src/pages.json:
--------------------------------------------------------------------------------
1 | {
2 | "pages": [
3 | {
4 | "path": "pages/index/index",
5 | "style": {
6 | "navigationBarTitleText": "uni-unocss-starter"
7 | }
8 | }
9 | ],
10 | "globalStyle": {
11 | "navigationBarTextStyle": "black",
12 | "navigationBarTitleText": "uni-unocss-starter",
13 | "navigationBarBackgroundColor": "#F8F8F8",
14 | "backgroundColor": "#F8F8F8"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/pages/index/index.vue:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 | {{ foo }}
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/static/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DimplesY/uniapp-unocss-starter/f652828625ce8fd969e650ed06f1081680679f1a/src/static/logo.png
--------------------------------------------------------------------------------
/src/store/index.ts:
--------------------------------------------------------------------------------
1 | export * from './modules/foo'
2 |
--------------------------------------------------------------------------------
/src/store/modules/foo/index.ts:
--------------------------------------------------------------------------------
1 | export const STORE_KEY = 'foo'
2 |
3 | export const useFooStore = defineStore(STORE_KEY, () => {
4 | const foo = ref(0)
5 |
6 | function increment() {
7 | foo.value++
8 | }
9 |
10 | function decrement() {
11 | foo.value--
12 | }
13 |
14 | return {
15 | foo,
16 | increment,
17 | decrement,
18 | }
19 | })
20 |
21 | export default useFooStore
22 |
--------------------------------------------------------------------------------
/src/types/auto-imports.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | /* prettier-ignore */
3 | // @ts-nocheck
4 | // noinspection JSUnusedGlobalSymbols
5 | // Generated by unplugin-auto-import
6 | export {}
7 | declare global {
8 | const EffectScope: typeof import('vue')['EffectScope']
9 | const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
10 | const computed: typeof import('vue')['computed']
11 | const createApp: typeof import('vue')['createApp']
12 | const createPinia: typeof import('pinia')['createPinia']
13 | const customRef: typeof import('vue')['customRef']
14 | const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
15 | const defineComponent: typeof import('vue')['defineComponent']
16 | const defineStore: typeof import('pinia')['defineStore']
17 | const effectScope: typeof import('vue')['effectScope']
18 | const getActivePinia: typeof import('pinia')['getActivePinia']
19 | const getCurrentInstance: typeof import('vue')['getCurrentInstance']
20 | const getCurrentScope: typeof import('vue')['getCurrentScope']
21 | const h: typeof import('vue')['h']
22 | const inject: typeof import('vue')['inject']
23 | const isProxy: typeof import('vue')['isProxy']
24 | const isReactive: typeof import('vue')['isReactive']
25 | const isReadonly: typeof import('vue')['isReadonly']
26 | const isRef: typeof import('vue')['isRef']
27 | const mapActions: typeof import('pinia')['mapActions']
28 | const mapGetters: typeof import('pinia')['mapGetters']
29 | const mapState: typeof import('pinia')['mapState']
30 | const mapStores: typeof import('pinia')['mapStores']
31 | const mapWritableState: typeof import('pinia')['mapWritableState']
32 | const markRaw: typeof import('vue')['markRaw']
33 | const nextTick: typeof import('vue')['nextTick']
34 | const onActivated: typeof import('vue')['onActivated']
35 | const onAddToFavorites: typeof import('@dcloudio/uni-app')['onAddToFavorites']
36 | const onBackPress: typeof import('@dcloudio/uni-app')['onBackPress']
37 | const onBeforeMount: typeof import('vue')['onBeforeMount']
38 | const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
39 | const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
40 | const onDeactivated: typeof import('vue')['onDeactivated']
41 | const onError: typeof import('@dcloudio/uni-app')['onError']
42 | const onErrorCaptured: typeof import('vue')['onErrorCaptured']
43 | const onHide: typeof import('@dcloudio/uni-app')['onHide']
44 | const onLaunch: typeof import('@dcloudio/uni-app')['onLaunch']
45 | const onLoad: typeof import('@dcloudio/uni-app')['onLoad']
46 | const onMounted: typeof import('vue')['onMounted']
47 | const onNavigationBarButtonTap: typeof import('@dcloudio/uni-app')['onNavigationBarButtonTap']
48 | const onNavigationBarSearchInputChanged: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputChanged']
49 | const onNavigationBarSearchInputClicked: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputClicked']
50 | const onNavigationBarSearchInputConfirmed: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputConfirmed']
51 | const onNavigationBarSearchInputFocusChanged: typeof import('@dcloudio/uni-app')['onNavigationBarSearchInputFocusChanged']
52 | const onPageNotFound: typeof import('@dcloudio/uni-app')['onPageNotFound']
53 | const onPageScroll: typeof import('@dcloudio/uni-app')['onPageScroll']
54 | const onPullDownRefresh: typeof import('@dcloudio/uni-app')['onPullDownRefresh']
55 | const onReachBottom: typeof import('@dcloudio/uni-app')['onReachBottom']
56 | const onReady: typeof import('@dcloudio/uni-app')['onReady']
57 | const onRenderTracked: typeof import('vue')['onRenderTracked']
58 | const onRenderTriggered: typeof import('vue')['onRenderTriggered']
59 | const onResize: typeof import('@dcloudio/uni-app')['onResize']
60 | const onScopeDispose: typeof import('vue')['onScopeDispose']
61 | const onServerPrefetch: typeof import('vue')['onServerPrefetch']
62 | const onShareAppMessage: typeof import('@dcloudio/uni-app')['onShareAppMessage']
63 | const onShareTimeline: typeof import('@dcloudio/uni-app')['onShareTimeline']
64 | const onShow: typeof import('@dcloudio/uni-app')['onShow']
65 | const onTabItemTap: typeof import('@dcloudio/uni-app')['onTabItemTap']
66 | const onThemeChange: typeof import('@dcloudio/uni-app')['onThemeChange']
67 | const onUnhandledRejection: typeof import('@dcloudio/uni-app')['onUnhandledRejection']
68 | const onUnload: typeof import('@dcloudio/uni-app')['onUnload']
69 | const onUnmounted: typeof import('vue')['onUnmounted']
70 | const onUpdated: typeof import('vue')['onUpdated']
71 | const onWatcherCleanup: typeof import('vue')['onWatcherCleanup']
72 | const provide: typeof import('vue')['provide']
73 | const reactive: typeof import('vue')['reactive']
74 | const readonly: typeof import('vue')['readonly']
75 | const ref: typeof import('vue')['ref']
76 | const resolveComponent: typeof import('vue')['resolveComponent']
77 | const setActivePinia: typeof import('pinia')['setActivePinia']
78 | const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
79 | const shallowReactive: typeof import('vue')['shallowReactive']
80 | const shallowReadonly: typeof import('vue')['shallowReadonly']
81 | const shallowRef: typeof import('vue')['shallowRef']
82 | const storeToRefs: typeof import('pinia')['storeToRefs']
83 | const toRaw: typeof import('vue')['toRaw']
84 | const toRef: typeof import('vue')['toRef']
85 | const toRefs: typeof import('vue')['toRefs']
86 | const toValue: typeof import('vue')['toValue']
87 | const triggerRef: typeof import('vue')['triggerRef']
88 | const unref: typeof import('vue')['unref']
89 | const useAttrs: typeof import('vue')['useAttrs']
90 | const useCssModule: typeof import('vue')['useCssModule']
91 | const useCssVars: typeof import('vue')['useCssVars']
92 | const useId: typeof import('vue')['useId']
93 | const useModel: typeof import('vue')['useModel']
94 | const useSlots: typeof import('vue')['useSlots']
95 | const useTemplateRef: typeof import('vue')['useTemplateRef']
96 | const watch: typeof import('vue')['watch']
97 | const watchEffect: typeof import('vue')['watchEffect']
98 | const watchPostEffect: typeof import('vue')['watchPostEffect']
99 | const watchSyncEffect: typeof import('vue')['watchSyncEffect']
100 | }
101 | // for type re-export
102 | declare global {
103 | // @ts-ignore
104 | export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
105 | import('vue')
106 | }
107 | // for vue template auto import
108 | import { UnwrapRef } from 'vue'
109 | declare module 'vue' {
110 | interface GlobalComponents {}
111 | interface ComponentCustomProperties {
112 | readonly EffectScope: UnwrapRef
113 | readonly acceptHMRUpdate: UnwrapRef
114 | readonly computed: UnwrapRef
115 | readonly createApp: UnwrapRef
116 | readonly createPinia: UnwrapRef
117 | readonly customRef: UnwrapRef
118 | readonly defineAsyncComponent: UnwrapRef
119 | readonly defineComponent: UnwrapRef
120 | readonly defineStore: UnwrapRef
121 | readonly effectScope: UnwrapRef
122 | readonly getActivePinia: UnwrapRef
123 | readonly getCurrentInstance: UnwrapRef
124 | readonly getCurrentScope: UnwrapRef
125 | readonly h: UnwrapRef
126 | readonly inject: UnwrapRef
127 | readonly isProxy: UnwrapRef
128 | readonly isReactive: UnwrapRef
129 | readonly isReadonly: UnwrapRef
130 | readonly isRef: UnwrapRef
131 | readonly mapActions: UnwrapRef
132 | readonly mapGetters: UnwrapRef
133 | readonly mapState: UnwrapRef
134 | readonly mapStores: UnwrapRef
135 | readonly mapWritableState: UnwrapRef
136 | readonly markRaw: UnwrapRef
137 | readonly nextTick: UnwrapRef
138 | readonly onActivated: UnwrapRef
139 | readonly onAddToFavorites: UnwrapRef
140 | readonly onBackPress: UnwrapRef
141 | readonly onBeforeMount: UnwrapRef
142 | readonly onBeforeUnmount: UnwrapRef
143 | readonly onBeforeUpdate: UnwrapRef
144 | readonly onDeactivated: UnwrapRef
145 | readonly onError: UnwrapRef
146 | readonly onErrorCaptured: UnwrapRef
147 | readonly onHide: UnwrapRef
148 | readonly onLaunch: UnwrapRef
149 | readonly onLoad: UnwrapRef
150 | readonly onMounted: UnwrapRef
151 | readonly onNavigationBarButtonTap: UnwrapRef
152 | readonly onNavigationBarSearchInputChanged: UnwrapRef
153 | readonly onNavigationBarSearchInputClicked: UnwrapRef
154 | readonly onNavigationBarSearchInputConfirmed: UnwrapRef
155 | readonly onNavigationBarSearchInputFocusChanged: UnwrapRef
156 | readonly onPageNotFound: UnwrapRef
157 | readonly onPageScroll: UnwrapRef
158 | readonly onPullDownRefresh: UnwrapRef
159 | readonly onReachBottom: UnwrapRef
160 | readonly onReady: UnwrapRef
161 | readonly onRenderTracked: UnwrapRef
162 | readonly onRenderTriggered: UnwrapRef
163 | readonly onResize: UnwrapRef
164 | readonly onScopeDispose: UnwrapRef
165 | readonly onServerPrefetch: UnwrapRef
166 | readonly onShareAppMessage: UnwrapRef
167 | readonly onShareTimeline: UnwrapRef
168 | readonly onShow: UnwrapRef
169 | readonly onTabItemTap: UnwrapRef
170 | readonly onThemeChange: UnwrapRef
171 | readonly onUnhandledRejection: UnwrapRef
172 | readonly onUnload: UnwrapRef
173 | readonly onUnmounted: UnwrapRef
174 | readonly onUpdated: UnwrapRef
175 | readonly onWatcherCleanup: UnwrapRef
176 | readonly provide: UnwrapRef
177 | readonly reactive: UnwrapRef
178 | readonly readonly: UnwrapRef
179 | readonly ref: UnwrapRef
180 | readonly resolveComponent: UnwrapRef
181 | readonly setActivePinia: UnwrapRef
182 | readonly setMapStoreSuffix: UnwrapRef
183 | readonly shallowReactive: UnwrapRef
184 | readonly shallowReadonly: UnwrapRef
185 | readonly shallowRef: UnwrapRef
186 | readonly storeToRefs: UnwrapRef
187 | readonly toRaw: UnwrapRef
188 | readonly toRef: UnwrapRef
189 | readonly toRefs: UnwrapRef
190 | readonly toValue: UnwrapRef
191 | readonly triggerRef: UnwrapRef
192 | readonly unref: UnwrapRef
193 | readonly useAttrs: UnwrapRef
194 | readonly useCssModule: UnwrapRef
195 | readonly useCssVars: UnwrapRef
196 | readonly useId: UnwrapRef
197 | readonly useModel: UnwrapRef
198 | readonly useSlots: UnwrapRef
199 | readonly useTemplateRef: UnwrapRef
200 | readonly watch: UnwrapRef
201 | readonly watchEffect: UnwrapRef
202 | readonly watchPostEffect: UnwrapRef
203 | readonly watchSyncEffect: UnwrapRef
204 | }
205 | }
206 |
--------------------------------------------------------------------------------
/src/types/env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare module '*.vue' {
4 | import type { DefineComponent } from 'vue'
5 | // eslint-disable-next-line ts/ban-types
6 | const component: DefineComponent<{}, {}, any>
7 | export default component
8 | }
9 |
--------------------------------------------------------------------------------
/src/types/shims-uni.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | import 'vue'
3 |
4 | declare module '@vue/runtime-core' {
5 | type Hooks = App.AppInstance & Page.PageInstance;
6 |
7 | interface ComponentCustomOptions extends Hooks {
8 |
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/uni.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * 这里是uni-app内置的常用样式变量
3 | *
4 | * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
5 | * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
6 | *
7 | */
8 |
9 | /**
10 | * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
11 | *
12 | * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
13 | */
14 |
15 | /* 颜色变量 */
16 |
17 | /* 行为相关颜色 */
18 | $uni-color-primary: #007aff;
19 | $uni-color-success: #4cd964;
20 | $uni-color-warning: #f0ad4e;
21 | $uni-color-error: #dd524d;
22 |
23 | /* 文字基本颜色 */
24 | $uni-text-color: #333; //基本色
25 | $uni-text-color-inverse: #fff; //反色
26 | $uni-text-color-grey: #999; //辅助灰色,如加载更多的提示信息
27 | $uni-text-color-placeholder: #808080;
28 | $uni-text-color-disable: #c0c0c0;
29 |
30 | /* 背景颜色 */
31 | $uni-bg-color: #ffffff;
32 | $uni-bg-color-grey: #f8f8f8;
33 | $uni-bg-color-hover: #f1f1f1; //点击状态颜色
34 | $uni-bg-color-mask: rgba(0, 0, 0, 0.4); //遮罩颜色
35 |
36 | /* 边框颜色 */
37 | $uni-border-color: #c8c7cc;
38 |
39 | /* 尺寸变量 */
40 |
41 | /* 文字尺寸 */
42 | $uni-font-size-sm: 24rpx;
43 | $uni-font-size-base: 28rpx;
44 | $uni-font-size-lg: 32rpx;
45 |
46 | /* 图片尺寸 */
47 | $uni-img-size-sm: 40rpx;
48 | $uni-img-size-base: 52rpx;
49 | $uni-img-size-lg: 80rpx;
50 |
51 | /* Border Radius */
52 | $uni-border-radius-sm: 4rpx;
53 | $uni-border-radius-base: 6rpx;
54 | $uni-border-radius-lg: 12rpx;
55 | $uni-border-radius-circle: 50%;
56 |
57 | /* 水平间距 */
58 | $uni-spacing-row-sm: 10px;
59 | $uni-spacing-row-base: 20rpx;
60 | $uni-spacing-row-lg: 30rpx;
61 |
62 | /* 垂直间距 */
63 | $uni-spacing-col-sm: 8rpx;
64 | $uni-spacing-col-base: 16rpx;
65 | $uni-spacing-col-lg: 24rpx;
66 |
67 | /* 透明度 */
68 | $uni-opacity-disabled: 0.3; // 组件禁用态的透明度
69 |
70 | /* 文章场景相关 */
71 | $uni-color-title: #2c405a; // 文章标题颜色
72 | $uni-font-size-title: 40rpx;
73 | $uni-color-subtitle: #555555; // 二级标题颜色
74 | $uni-font-size-subtitle: 36rpx;
75 | $uni-color-paragraph: #3f536e; // 文章段落颜色
76 | $uni-font-size-paragraph: 30rpx;
77 |
--------------------------------------------------------------------------------
/taze.config.js:
--------------------------------------------------------------------------------
1 | import { defineConfig } from 'taze'
2 |
3 | export default defineConfig({
4 | exclude: [
5 | 'pinia',
6 | ],
7 | })
8 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "@vue/tsconfig/tsconfig.json",
3 | "compilerOptions": {
4 | "lib": ["esnext", "dom"],
5 | "baseUrl": ".",
6 | "paths": {
7 | "@/*": ["./src/*"]
8 | },
9 | "types": ["@dcloudio/types", "@types/node"],
10 | "sourceMap": true
11 | },
12 | "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
13 | }
14 |
--------------------------------------------------------------------------------
/unocss.config.ts:
--------------------------------------------------------------------------------
1 | import presetWeapp from 'unocss-preset-weapp'
2 | import { extractorAttributify, transformerClass } from 'unocss-preset-weapp/transformer'
3 |
4 | const { presetWeappAttributify, transformerAttributify } = extractorAttributify()
5 |
6 | export default {
7 | presets: [
8 | // https://github.com/MellowCo/unocss-preset-weapp
9 | presetWeapp(),
10 | // attributify autocomplete
11 | presetWeappAttributify(),
12 | ],
13 | shortcuts: [
14 | ],
15 | transformers: [
16 | // https://github.com/MellowCo/unocss-preset-weapp/tree/mainrn/src/transformer/transformerAttributify
17 | transformerAttributify(),
18 |
19 | // https://github.com/MellowCo/unocss-preset-weapp/tree/main/src/transformer/transformerClass
20 | transformerClass(),
21 | ],
22 | }
23 |
--------------------------------------------------------------------------------
/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { fileURLToPath } from 'node:url'
2 | import { defineConfig } from 'vite'
3 | import createVitePlugins from './vite/plugins'
4 |
5 | // https://vitejs.dev/config/
6 | export default defineConfig(async () => {
7 | const UnoCSS = await import('unocss/vite').then(i => i.default)
8 | return {
9 | plugins: [
10 | ...createVitePlugins(),
11 | UnoCSS(),
12 | ],
13 | resolve: {
14 | alias: [
15 | {
16 | find: '@',
17 | replacement: fileURLToPath(new URL('./src', import.meta.url)),
18 | },
19 | ],
20 | },
21 | }
22 | })
23 |
--------------------------------------------------------------------------------
/vite/plugins/auto-import.ts:
--------------------------------------------------------------------------------
1 | import type { Options } from 'unplugin-auto-import/types'
2 | import AutoImport from 'unplugin-auto-import/vite'
3 |
4 | export default function createAutoImport(options?: Options) {
5 | return AutoImport({
6 | imports: ['uni-app', 'vue', 'pinia'],
7 | dts: 'src/types/auto-imports.d.ts',
8 | vueTemplate: true,
9 | ...options,
10 | })
11 | }
12 |
--------------------------------------------------------------------------------
/vite/plugins/index.ts:
--------------------------------------------------------------------------------
1 | import uni from '@dcloudio/vite-plugin-uni'
2 | import createAutoImport from './auto-import'
3 |
4 | export default function createVitePlugins() {
5 | const vitePlugins = [uni()]
6 | vitePlugins.push(createAutoImport())
7 | return vitePlugins
8 | }
9 |
--------------------------------------------------------------------------------