├── .editorconfig
├── .eslintignore
├── .eslintrc
├── .gitignore
├── README.md
├── babel.config.js
├── config
├── dev.js
├── index.js
└── prod.js
├── package.json
├── pnpm-lock.yaml
├── project.config.json
├── project.tt.json
├── src
├── app.config.ts
├── app.less
├── app.ts
├── components
│ ├── Counter.vue
│ ├── Test.vue
│ └── Test2.vue
├── index.html
├── pages
│ └── index
│ │ ├── index.config.ts
│ │ ├── index.less
│ │ └── index.vue
├── stores
│ └── counter.ts
└── utils
│ └── request.ts
├── tsconfig.json
└── types
├── auto-imports.d.ts
├── components.d.ts
└── global.d.ts
/.editorconfig:
--------------------------------------------------------------------------------
1 | # http://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | indent_style = space
6 | indent_size = 2
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | src/index.html
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | // ESLint 检查 .vue 文件需要单独配置编辑器:
2 | // https://eslint.vuejs.org/user-guide/#editor-integrations
3 | {
4 | "extends": ["@mistjs/eslint-config-vue"]
5 | }
6 |
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | dist/
2 | deploy_versions/
3 | .temp/
4 | .rn_temp/
5 | node_modules/
6 | .DS_Store
7 | .idea
8 | .vscode
9 | src/**/*.css
10 | .swc
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # taro-vue3-starter
2 | this is taro vue3 template
3 |
4 | vue3 + unocss + auto-import + vue-components
5 |
6 | base on [taro.3.6.x](https://taro-docs.jd.com/taro/docs/)
7 |
8 | ## Test
9 |
10 | 目前仅测试了微信小程序平台,其他平台需要自行测试
11 |
12 | ## support
13 |
14 | * html tag
15 | * vue3
16 | * unocss
17 | * auto-import
18 | * vue-components-unplugin (插件目前热更不生效,需要手动重启)
19 | * eslint-vue
20 | * 宏函数(taro3.4.x起)
21 |
22 | ## usage
23 |
24 |
25 | ```shell
26 |
27 | # use degit
28 |
29 | npm i -g degit
30 |
31 | degit mistjs/taro-vue3-starter myApp
32 |
33 | ```
34 |
35 | ## install
36 |
37 | ```shell
38 |
39 | yarn
40 |
41 | ```
42 |
43 | ## serve
44 |
45 | ### weapp
46 |
47 | ```shell
48 | yarn dev:weapp
49 | ```
50 |
51 | ## unocss
52 |
53 | 关于转换unocss:
54 |
55 | 目前仅支持`class`内去编写unocss的样式,尽量不要使用attribute的方式去编写样式,经测试,小程序不能完全兼容。
56 |
57 | 例如:
58 |
59 | ### 不推荐用法
60 |
61 | ```html
62 |
63 |
64 |
65 |
66 |
67 | ```
68 |
69 |
70 | ### 推荐写法
71 |
72 | ```html
73 |
74 |
75 |
76 |
77 |
78 | ```
79 |
80 |
81 | 更多使用方式请查看[unocss官网](https://uno.antfu.me/)
82 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | // babel-preset-taro 更多选项和默认值:
2 | // https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
3 | module.exports = {
4 | presets: [
5 | ['taro', {
6 | framework: 'vue3',
7 | ts: true,
8 | }],
9 | ],
10 | }
11 |
--------------------------------------------------------------------------------
/config/dev.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | NODE_ENV: '"development"',
4 | },
5 | defineConstants: {
6 | },
7 | mini: {},
8 | h5: {},
9 | }
10 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | import AutoImport from 'unplugin-auto-import/webpack'
2 | import Components from 'unplugin-vue-components/webpack'
3 | const commonChain = (chain) => {
4 | // https://github.com/antfu/unplugin-auto-import
5 | chain.plugin('unplugin-auto-import').use(AutoImport({
6 | imports: [
7 | 'vue',
8 | 'pinia',
9 | ],
10 | dts: 'types/auto-imports.d.ts',
11 | dirs: [
12 | 'src/composables',
13 | 'src/stores',
14 | ],
15 | vueTemplate: true,
16 | }))
17 | // 添加组件按需引入, 自动引入 `src/components` 目录下的组件
18 | // https://github.com/antfu/unplugin-vue-components
19 | chain.plugin('unplugin-vue-components').use(Components({
20 | dts: 'types/components.d.ts',
21 | dirs: ['src/components', 'src/layouts'],
22 | }))
23 | chain.merge({
24 | module: {
25 | rule: {
26 | mjsScript: {
27 | test: /\.mjs$/,
28 | include: [/pinia/, /unplugin-vue-components/, /unplugin-auto-import/],
29 | use: {
30 | babelLoader: {
31 | loader: require.resolve('babel-loader'),
32 | },
33 | },
34 | },
35 | },
36 | },
37 | })
38 | }
39 | const config = {
40 | projectName: 'aa',
41 | date: '2022-8-25',
42 | designWidth: 750,
43 | deviceRatio: {
44 | 640: 2.34 / 2,
45 | 750: 1,
46 | 828: 1.81 / 2,
47 | },
48 | sourceRoot: 'src',
49 | outputRoot: 'dist',
50 | plugins: [
51 | 'taro-plugin-pinia',
52 | '@tarojs/plugin-html',
53 | '@tarojs/plugin-http',
54 | ['taro-plugin-unocss', {
55 | preset: {
56 | remToRpx: {
57 | baseFontSize: 4,
58 | },
59 | },
60 | }]],
61 | defineConstants: {
62 | },
63 | copy: {
64 | patterns: [
65 | ],
66 | options: {
67 | },
68 | },
69 | framework: 'vue3',
70 | compiler: 'webpack5',
71 | cache: {
72 | enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
73 | },
74 | mini: {
75 | webpackChain(chain) {
76 | commonChain(chain)
77 | },
78 | postcss: {
79 | pxtransform: {
80 | enable: true,
81 | config: {
82 |
83 | },
84 | },
85 | url: {
86 | enable: true,
87 | config: {
88 | limit: 1024, // 设定转换尺寸上限
89 | },
90 | },
91 | cssModules: {
92 | enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
93 | config: {
94 | namingPattern: 'module', // 转换模式,取值为 global/module
95 | generateScopedName: '[name]__[local]___[hash:base64:5]',
96 | },
97 | },
98 | },
99 | },
100 | h5: {
101 | webpackChain(chain) {
102 | commonChain(chain)
103 | },
104 | publicPath: '/',
105 | staticDirectory: 'static',
106 | postcss: {
107 | autoprefixer: {
108 | enable: true,
109 | config: {
110 | },
111 | },
112 | cssModules: {
113 | enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
114 | config: {
115 | namingPattern: 'module', // 转换模式,取值为 global/module
116 | generateScopedName: '[name]__[local]___[hash:base64:5]',
117 | },
118 | },
119 | },
120 | },
121 | }
122 |
123 | module.exports = function(merge) {
124 | if (process.env.NODE_ENV === 'development')
125 | return merge({}, config, require('./dev'))
126 |
127 | return merge({}, config, require('./prod'))
128 | }
129 |
--------------------------------------------------------------------------------
/config/prod.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | NODE_ENV: '"production"',
4 | },
5 | defineConstants: {
6 | },
7 | mini: {},
8 | h5: {
9 | /**
10 | * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
11 | * 参考代码如下:
12 | * webpackChain (chain) {
13 | * chain.plugin('analyzer')
14 | * .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
15 | * }
16 | */
17 | },
18 | }
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "taro-for-unocss",
3 | "version": "1.0.0",
4 | "private": true,
5 | "description": "taro project for 3.6.x use vue pinia and unocss",
6 | "templateInfo": {
7 | "name": "vue3-pinia-unocss",
8 | "typescript": true,
9 | "css": "less"
10 | },
11 | "scripts": {
12 | "build:weapp": "taro build --type weapp",
13 | "build:swan": "taro build --type swan",
14 | "build:alipay": "taro build --type alipay",
15 | "build:tt": "taro build --type tt",
16 | "build:h5": "taro build --type h5",
17 | "build:rn": "taro build --type rn",
18 | "build:qq": "taro build --type qq",
19 | "build:quickapp": "taro build --type quickapp",
20 | "dev:weapp": "npm run build:weapp -- --watch",
21 | "dev:swan": "npm run build:swan -- --watch",
22 | "dev:alipay": "npm run build:alipay -- --watch",
23 | "dev:tt": "npm run build:tt -- --watch",
24 | "dev:h5": "npm run build:h5 -- --watch",
25 | "dev:rn": "npm run build:rn -- --watch",
26 | "dev:qq": "npm run build:qq -- --watch",
27 | "dev:quickapp": "npm run build:quickapp -- --watch"
28 | },
29 | "browserslist": [
30 | "last 3 versions",
31 | "Android >= 4.1",
32 | "ios >= 8"
33 | ],
34 | "author": "",
35 | "license": "MIT",
36 | "dependencies": {
37 | "@babel/runtime": "^7.21.0",
38 | "@tarojs/components": "3.6.13",
39 | "@tarojs/helper": "3.6.13",
40 | "@tarojs/plugin-framework-vue3": "3.6.13",
41 | "@tarojs/plugin-http": "3.6.13",
42 | "@tarojs/plugin-platform-alipay": "3.6.13",
43 | "@tarojs/plugin-platform-h5": "3.6.13",
44 | "@tarojs/plugin-platform-jd": "3.6.13",
45 | "@tarojs/plugin-platform-qq": "3.6.13",
46 | "@tarojs/plugin-platform-swan": "3.6.13",
47 | "@tarojs/plugin-platform-tt": "3.6.13",
48 | "@tarojs/plugin-platform-weapp": "3.6.13",
49 | "@tarojs/runtime": "3.6.13",
50 | "@tarojs/shared": "3.6.13",
51 | "@tarojs/taro": "3.6.13",
52 | "axios": "^1.4.0",
53 | "pinia": "^2.0.34",
54 | "taro-plugin-pinia": "^1.0.0",
55 | "taro-plugin-unocss": "^0.0.3",
56 | "vue": "^3.2.47"
57 | },
58 | "devDependencies": {
59 | "@babel/core": "^7.21.4",
60 | "@mistjs/eslint-config-vue": "^0.0.2",
61 | "@tarojs/cli": "3.6.13",
62 | "@tarojs/plugin-html": "^3.6.13",
63 | "@tarojs/webpack5-runner": "3.6.13",
64 | "@types/webpack-env": "^1.18.0",
65 | "@typescript-eslint/eslint-plugin": "^5.57.1",
66 | "@typescript-eslint/parser": "^5.57.1",
67 | "@vue/babel-plugin-jsx": "^1.1.1",
68 | "@vue/compiler-sfc": "^3.2.47",
69 | "babel-preset-taro": "3.6.13",
70 | "css-loader": "3.4.2",
71 | "eslint": "^8.38.0",
72 | "eslint-config-taro": "3.6.13",
73 | "eslint-plugin-vue": "^8.7.1",
74 | "postcss": "^8.4.21",
75 | "style-loader": "1.3.0",
76 | "stylelint": "9.3.0",
77 | "taro-plugin-unocss": "0.0.3",
78 | "typescript": "^4.9.5",
79 | "unplugin-auto-import": "^0.11.5",
80 | "unplugin-vue-components": "^0.22.12",
81 | "vue-loader": "^16.8.3",
82 | "webpack": "5.78.0"
83 | },
84 | "pnpm": {
85 | "peerDependencyRules": {
86 | "ignoreMissing": [
87 | "vite"
88 | ]
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/project.config.json:
--------------------------------------------------------------------------------
1 | {
2 | "miniprogramRoot": "./dist",
3 | "projectname": "aa",
4 | "description": "taro project for 3.5.x",
5 | "appid": "touristappid",
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": false,
9 | "enhance": false,
10 | "compileHotReLoad": false,
11 | "postcss": false,
12 | "minified": false
13 | },
14 | "compileType": "miniprogram"
15 | }
16 |
--------------------------------------------------------------------------------
/project.tt.json:
--------------------------------------------------------------------------------
1 | {
2 | "miniprogramRoot": "./",
3 | "projectname": "aa",
4 | "description": "taro project for 3.5.x",
5 | "appid": "touristappid",
6 | "setting": {
7 | "urlCheck": true,
8 | "es6": false,
9 | "postcss": false,
10 | "minified": false
11 | },
12 | "compileType": "miniprogram"
13 | }
14 |
--------------------------------------------------------------------------------
/src/app.config.ts:
--------------------------------------------------------------------------------
1 | export default defineAppConfig({
2 | pages: [
3 | 'pages/index/index',
4 | ],
5 | window: {
6 | backgroundTextStyle: 'light',
7 | navigationBarBackgroundColor: '#fff',
8 | navigationBarTitleText: 'WeChat',
9 | navigationBarTextStyle: 'black',
10 | },
11 | })
12 |
--------------------------------------------------------------------------------
/src/app.less:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mistjs/taro-vue3-starter/5d6674492002327283718d5464eebed551165402/src/app.less
--------------------------------------------------------------------------------
/src/app.ts:
--------------------------------------------------------------------------------
1 | import { createApp } from 'vue'
2 | import { createPinia } from 'pinia'
3 | import 'uno.css'
4 | import './app.less'
5 |
6 | const App = createApp({
7 | onShow(_options) {
8 | },
9 | // 入口组件不需要实现 render 方法,即使实现了也会被 taro 所覆盖
10 | })
11 |
12 | App.use(createPinia())
13 |
14 | export default App
15 |
--------------------------------------------------------------------------------
/src/components/Counter.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {{ counter.count }}
5 |
6 |
7 | ADD
8 |
9 |
10 |
11 |
12 |
27 |
28 |
37 |
--------------------------------------------------------------------------------
/src/components/Test.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | Test
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/components/Test2.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 | Test2
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | aa
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/pages/index/index.config.ts:
--------------------------------------------------------------------------------
1 | export default definePageConfig({
2 | navigationBarTitleText: '首页',
3 | })
4 |
--------------------------------------------------------------------------------
/src/pages/index/index.less:
--------------------------------------------------------------------------------
1 | .test-cls{
2 | padding: 40px;
3 | }
--------------------------------------------------------------------------------
/src/pages/index/index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 | {{ requestData }}
8 |
9 |
10 |
11 |
19 |
--------------------------------------------------------------------------------
/src/stores/counter.ts:
--------------------------------------------------------------------------------
1 | // https://pinia.esm.dev/introduction.html
2 | import { defineStore } from 'pinia'
3 |
4 | export const useCounterStore = defineStore('counter', {
5 | state: () => {
6 | return { count: 0 }
7 | },
8 | // could also be defined as
9 | // state: () => ({ count: 0 })
10 | actions: {
11 | increment() {
12 | this.count++
13 | },
14 | },
15 | })
16 |
17 | // You can even use a function (similar to a component setup()) to define a Store for more advanced use cases:
18 | // export const useCounterStore = defineStore('counter', () => {
19 | // const count = ref(0)
20 | //
21 | // function increment() {
22 | // count.value++
23 | // }
24 | //
25 | // return {count, increment}
26 | // })
27 |
--------------------------------------------------------------------------------
/src/utils/request.ts:
--------------------------------------------------------------------------------
1 | import type { AxiosError, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
2 | import axios from 'axios'
3 |
4 | const instance = axios.create({
5 | baseURL: 'https://mock.lingyu.org.cn/mock/642b5d1e939061307ed09d1b/example',
6 | timeout: 60000,
7 | })
8 |
9 | const requestHandler = async(config: InternalAxiosRequestConfig): Promise => {
10 | // 新增缓存
11 | // const token = useAuthorization()
12 | // if (token.value) {
13 | // config.headers.set(STORAGE_AUTHORIZE_KEY, token.value)
14 | // }
15 | return config
16 | }
17 |
18 | export interface ResponseBody {
19 | code: number
20 | data?: T
21 | msg: string
22 | }
23 | const responseHandler = (response: any): ResponseBody | AxiosResponse | Promise | any => {
24 | return response.data
25 | }
26 |
27 | const errorHandler = (error: AxiosError): Promise => {
28 | return Promise.reject(error)
29 | }
30 |
31 | instance.interceptors.request.use(requestHandler, errorHandler)
32 |
33 | instance.interceptors.response.use(responseHandler, errorHandler)
34 |
35 | export const useGet = (url: string, params?: T, config?: AxiosRequestConfig): Promise> => {
36 | return instance.request({
37 | url,
38 | params,
39 | method: 'GET',
40 | ...config,
41 | })
42 | }
43 |
44 | export const usePost = (url: string, data?: T, config?: AxiosRequestConfig): Promise> => {
45 | return instance.request({
46 | url,
47 | data,
48 | method: 'POST',
49 | ...config,
50 | })
51 | }
52 |
53 | export const usePut = (url: string, data?: T, config?: AxiosRequestConfig): Promise> => {
54 | return instance.request({
55 | url,
56 | data,
57 | method: 'PUT',
58 | ...config,
59 | })
60 | }
61 |
62 | export const useDelete = (url: string, data?: T, config?: AxiosRequestConfig): Promise> => {
63 | return instance.request({
64 | url,
65 | data,
66 | method: 'DELETE',
67 | ...config,
68 | })
69 | }
70 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2017",
4 | "module": "commonjs",
5 | "removeComments": false,
6 | "preserveConstEnums": true,
7 | "moduleResolution": "node",
8 | "experimentalDecorators": true,
9 | "noImplicitAny": false,
10 | "allowSyntheticDefaultImports": true,
11 | "outDir": "lib",
12 | "noUnusedLocals": true,
13 | "noUnusedParameters": true,
14 | "strictNullChecks": true,
15 | "sourceMap": true,
16 | "baseUrl": ".",
17 | "rootDir": ".",
18 | "jsx": "preserve",
19 | "allowJs": true,
20 | "resolveJsonModule": true,
21 | "typeRoots": [
22 | "node_modules/@types"
23 | ]
24 | },
25 | "include": ["./src", "./types"],
26 | "compileOnSave": false
27 | }
28 |
--------------------------------------------------------------------------------
/types/auto-imports.d.ts:
--------------------------------------------------------------------------------
1 | // Generated by 'unplugin-auto-import'
2 | export {}
3 | declare global {
4 | const EffectScope: typeof import('vue')['EffectScope']
5 | const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
6 | const computed: typeof import('vue')['computed']
7 | const createApp: typeof import('vue')['createApp']
8 | const createPinia: typeof import('pinia')['createPinia']
9 | const customRef: typeof import('vue')['customRef']
10 | const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
11 | const defineComponent: typeof import('vue')['defineComponent']
12 | const defineStore: typeof import('pinia')['defineStore']
13 | const effectScope: typeof import('vue')['effectScope']
14 | const getActivePinia: typeof import('pinia')['getActivePinia']
15 | const getCurrentInstance: typeof import('vue')['getCurrentInstance']
16 | const getCurrentScope: typeof import('vue')['getCurrentScope']
17 | const h: typeof import('vue')['h']
18 | const inject: typeof import('vue')['inject']
19 | const isProxy: typeof import('vue')['isProxy']
20 | const isReactive: typeof import('vue')['isReactive']
21 | const isReadonly: typeof import('vue')['isReadonly']
22 | const isRef: typeof import('vue')['isRef']
23 | const mapActions: typeof import('pinia')['mapActions']
24 | const mapGetters: typeof import('pinia')['mapGetters']
25 | const mapState: typeof import('pinia')['mapState']
26 | const mapStores: typeof import('pinia')['mapStores']
27 | const mapWritableState: typeof import('pinia')['mapWritableState']
28 | const markRaw: typeof import('vue')['markRaw']
29 | const nextTick: typeof import('vue')['nextTick']
30 | const onActivated: typeof import('vue')['onActivated']
31 | const onBeforeMount: typeof import('vue')['onBeforeMount']
32 | const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
33 | const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
34 | const onDeactivated: typeof import('vue')['onDeactivated']
35 | const onErrorCaptured: typeof import('vue')['onErrorCaptured']
36 | const onMounted: typeof import('vue')['onMounted']
37 | const onRenderTracked: typeof import('vue')['onRenderTracked']
38 | const onRenderTriggered: typeof import('vue')['onRenderTriggered']
39 | const onScopeDispose: typeof import('vue')['onScopeDispose']
40 | const onServerPrefetch: typeof import('vue')['onServerPrefetch']
41 | const onUnmounted: typeof import('vue')['onUnmounted']
42 | const onUpdated: typeof import('vue')['onUpdated']
43 | const provide: typeof import('vue')['provide']
44 | const reactive: typeof import('vue')['reactive']
45 | const readonly: typeof import('vue')['readonly']
46 | const ref: typeof import('vue')['ref']
47 | const resolveComponent: typeof import('vue')['resolveComponent']
48 | const resolveDirective: typeof import('vue')['resolveDirective']
49 | const setActivePinia: typeof import('pinia')['setActivePinia']
50 | const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
51 | const shallowReactive: typeof import('vue')['shallowReactive']
52 | const shallowReadonly: typeof import('vue')['shallowReadonly']
53 | const shallowRef: typeof import('vue')['shallowRef']
54 | const storeToRefs: typeof import('pinia')['storeToRefs']
55 | const toRaw: typeof import('vue')['toRaw']
56 | const toRef: typeof import('vue')['toRef']
57 | const toRefs: typeof import('vue')['toRefs']
58 | const triggerRef: typeof import('vue')['triggerRef']
59 | const unref: typeof import('vue')['unref']
60 | const useAttrs: typeof import('vue')['useAttrs']
61 | const useCounterStore: typeof import('../src/stores/counter')['useCounterStore']
62 | const useCssModule: typeof import('vue')['useCssModule']
63 | const useCssVars: typeof import('vue')['useCssVars']
64 | const useSlots: typeof import('vue')['useSlots']
65 | const watch: typeof import('vue')['watch']
66 | const watchEffect: typeof import('vue')['watchEffect']
67 | const watchPostEffect: typeof import('vue')['watchPostEffect']
68 | const watchSyncEffect: typeof import('vue')['watchSyncEffect']
69 | }
70 | // for vue template auto import
71 | import { UnwrapRef } from 'vue'
72 | declare module 'vue' {
73 | interface ComponentCustomProperties {
74 | readonly EffectScope: UnwrapRef
75 | readonly acceptHMRUpdate: UnwrapRef
76 | readonly computed: UnwrapRef
77 | readonly createApp: UnwrapRef
78 | readonly createPinia: UnwrapRef
79 | readonly customRef: UnwrapRef
80 | readonly defineAsyncComponent: UnwrapRef
81 | readonly defineComponent: UnwrapRef
82 | readonly defineStore: UnwrapRef
83 | readonly effectScope: UnwrapRef
84 | readonly getActivePinia: UnwrapRef
85 | readonly getCurrentInstance: UnwrapRef
86 | readonly getCurrentScope: UnwrapRef
87 | readonly h: UnwrapRef
88 | readonly inject: UnwrapRef
89 | readonly isProxy: UnwrapRef
90 | readonly isReactive: UnwrapRef
91 | readonly isReadonly: UnwrapRef
92 | readonly isRef: UnwrapRef
93 | readonly mapActions: UnwrapRef
94 | readonly mapGetters: UnwrapRef
95 | readonly mapState: UnwrapRef
96 | readonly mapStores: UnwrapRef
97 | readonly mapWritableState: UnwrapRef
98 | readonly markRaw: UnwrapRef
99 | readonly nextTick: UnwrapRef
100 | readonly onActivated: UnwrapRef
101 | readonly onBeforeMount: UnwrapRef
102 | readonly onBeforeUnmount: UnwrapRef
103 | readonly onBeforeUpdate: UnwrapRef
104 | readonly onDeactivated: UnwrapRef
105 | readonly onErrorCaptured: UnwrapRef
106 | readonly onMounted: UnwrapRef
107 | readonly onRenderTracked: UnwrapRef
108 | readonly onRenderTriggered: UnwrapRef
109 | readonly onScopeDispose: UnwrapRef
110 | readonly onServerPrefetch: UnwrapRef
111 | readonly onUnmounted: UnwrapRef
112 | readonly onUpdated: UnwrapRef
113 | readonly provide: UnwrapRef
114 | readonly reactive: UnwrapRef
115 | readonly readonly: UnwrapRef
116 | readonly ref: UnwrapRef
117 | readonly resolveComponent: UnwrapRef
118 | readonly resolveDirective: UnwrapRef
119 | readonly setActivePinia: UnwrapRef
120 | readonly setMapStoreSuffix: UnwrapRef
121 | readonly shallowReactive: UnwrapRef
122 | readonly shallowReadonly: UnwrapRef
123 | readonly shallowRef: UnwrapRef
124 | readonly storeToRefs: UnwrapRef
125 | readonly toRaw: UnwrapRef
126 | readonly toRef: UnwrapRef
127 | readonly toRefs: UnwrapRef
128 | readonly triggerRef: UnwrapRef
129 | readonly unref: UnwrapRef
130 | readonly useAttrs: UnwrapRef
131 | readonly useCounterStore: UnwrapRef
132 | readonly useCssModule: UnwrapRef
133 | readonly useCssVars: UnwrapRef
134 | readonly useSlots: UnwrapRef
135 | readonly watch: UnwrapRef
136 | readonly watchEffect: UnwrapRef
137 | readonly watchPostEffect: UnwrapRef
138 | readonly watchSyncEffect: UnwrapRef
139 | }
140 | }
141 |
--------------------------------------------------------------------------------
/types/components.d.ts:
--------------------------------------------------------------------------------
1 | // generated by unplugin-vue-components
2 | // We suggest you to commit this file into source control
3 | // Read more: https://github.com/vuejs/core/pull/3399
4 | import '@vue/runtime-core'
5 |
6 | export {}
7 |
8 | declare module '@vue/runtime-core' {
9 | export interface GlobalComponents {
10 | Counter: typeof import('./../src/components/Counter.vue')['default']
11 | Test: typeof import('./../src/components/Test.vue')['default']
12 | Test2: typeof import('./../src/components/Test2.vue')['default']
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/types/global.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.png';
2 | declare module '*.gif';
3 | declare module '*.jpg';
4 | declare module '*.jpeg';
5 | declare module '*.svg';
6 | declare module '*.css';
7 | declare module '*.less';
8 | declare module '*.scss';
9 | declare module '*.sass';
10 | declare module '*.styl';
11 |
12 | // @ts-expect-error this global
13 | declare const process: {
14 | env: {
15 | TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq'
16 | [key: string]: any
17 | }
18 | }
19 |
20 | declare module '@tarojs/components' {
21 | export * from '@tarojs/components/types/index.vue3'
22 | }
23 |
24 | // @ts-expect-error this global
25 | declare global {
26 | import type Taro from '@tarojs/taro'
27 | const defineAppConfig: (config: Taro.Config) => Taro.Config
28 | const definePageConfig: (config: Taro.Config) => Taro.Config
29 | }
30 |
--------------------------------------------------------------------------------