diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 1e62e7f..081bf8b 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -72,4 +72,7 @@ module.exports = { typescript: {}, }, }, + globals: { + uni: true, + }, } diff --git a/package.json b/package.json index c69949d..954175a 100644 --- a/package.json +++ b/package.json @@ -77,8 +77,10 @@ "@dcloudio/uni-cli-shared": "3.0.0-3081220230817001", "@dcloudio/uni-stacktracey": "3.0.0-3081220230817001", "@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001", + "@types/wechat-miniprogram": "^3.4.7", "@typescript-eslint/eslint-plugin": "^6.15.0", "@typescript-eslint/parser": "^6.15.0", + "@uni-helper/uni-app-types": "^0.5.12", "@vue/runtime-core": "^3.2.45", "@vue/tsconfig": "^0.1.3", "autoprefixer": "^10.4.16", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index dc727b3..6967d89 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -76,12 +76,18 @@ devDependencies: '@dcloudio/vite-plugin-uni': specifier: 3.0.0-3081220230817001 version: 3.0.0-3081220230817001(postcss@8.4.32)(vite@4.1.4)(vue@3.2.47) + '@types/wechat-miniprogram': + specifier: ^3.4.7 + version: 3.4.7 '@typescript-eslint/eslint-plugin': specifier: ^6.15.0 version: 6.15.0(@typescript-eslint/parser@6.15.0)(eslint@8.56.0)(typescript@4.9.5) '@typescript-eslint/parser': specifier: ^6.15.0 version: 6.15.0(eslint@8.56.0)(typescript@4.9.5) + '@uni-helper/uni-app-types': + specifier: ^0.5.12 + version: 0.5.12(typescript@4.9.5) '@vue/runtime-core': specifier: ^3.2.45 version: 3.3.13 @@ -3559,6 +3565,10 @@ packages: '@types/node': 20.10.5 dev: true + /@types/wechat-miniprogram@3.4.7: + resolution: {integrity: sha512-X6SVOOaTPQN24lYBSV5jLuWyIedx8DGJnT0VUBnoNzJruhxotCL28ecGb7AO5JfXOXtHqSS5+CnJ70NxFxmisA==} + dev: true + /@types/yargs-parser@21.0.3: resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} dev: true @@ -3704,6 +3714,17 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true + /@uni-helper/uni-app-types@0.5.12(typescript@4.9.5): + resolution: {integrity: sha512-SeUEgDgGftI4XEp1AB3C6IFLnRPT83tgTCCmlLUBmQyHh+UhRY+CX4QtgQ0n/kF8txNUq8Bc9YwKlYdXQGx6Ww==} + engines: {node: '>=14.18'} + peerDependencies: + typescript: ^4.8.0 || ^5.0.0 + dependencies: + '@dcloudio/types': 3.4.3 + typescript: 4.9.5 + vue3: /vue@3.3.13(typescript@4.9.5) + dev: true + /@unocss/astro@0.58.0(vite@4.1.4): resolution: {integrity: sha512-df+tEFO5eKXjQOwSWQhS9IdjD0sfLHLtn8U09sEKR2Nmh5CvpwyBxmvLQgOCilPou7ehmyKfsyGRLZg7IMp+Ew==} peerDependencies: @@ -4050,12 +4071,34 @@ packages: postcss: 8.4.32 source-map: 0.6.1 + /@vue/compiler-sfc@3.3.13: + resolution: {integrity: sha512-DQVmHEy/EKIgggvnGRLx21hSqnr1smUS9Aq8tfxiiot8UR0/pXKHN9k78/qQ7etyQTFj5em5nruODON7dBeumw==} + dependencies: + '@babel/parser': 7.23.6 + '@vue/compiler-core': 3.3.13 + '@vue/compiler-dom': 3.3.13 + '@vue/compiler-ssr': 3.3.13 + '@vue/reactivity-transform': 3.3.13 + '@vue/shared': 3.3.13 + estree-walker: 2.0.2 + magic-string: 0.30.5 + postcss: 8.4.32 + source-map-js: 1.0.2 + dev: true + /@vue/compiler-ssr@3.2.47: resolution: {integrity: sha512-wVXC+gszhulcMD8wpxMsqSOpvDZ6xKXSVWkf50Guf/S+28hTAXPDYRTbLQ3EDkOP5Xz/+SY37YiwDquKbJOgZw==} dependencies: '@vue/compiler-dom': 3.2.47 '@vue/shared': 3.2.47 + /@vue/compiler-ssr@3.3.13: + resolution: {integrity: sha512-d/P3bCeUGmkJNS1QUZSAvoCIW4fkOKK3l2deE7zrp0ypJEy+En2AcypIkqvcFQOcw3F0zt2VfMvNsA9JmExTaw==} + dependencies: + '@vue/compiler-dom': 3.3.13 + '@vue/shared': 3.3.13 + dev: true + /@vue/devtools-api@6.5.1: resolution: {integrity: sha512-+KpckaAQyfbvshdDW5xQylLni1asvNSGme1JFs8I1+/H5pHEhqUKMEQD/qn3Nx5+/nycBq11qAEi8lk+LXI2dA==} dev: false @@ -4089,6 +4132,16 @@ packages: estree-walker: 2.0.2 magic-string: 0.25.9 + /@vue/reactivity-transform@3.3.13: + resolution: {integrity: sha512-oWnydGH0bBauhXvh5KXUy61xr9gKaMbtsMHk40IK9M4gMuKPJ342tKFarY0eQ6jef8906m35q37wwA8DMZOm5Q==} + dependencies: + '@babel/parser': 7.23.6 + '@vue/compiler-core': 3.3.13 + '@vue/shared': 3.3.13 + estree-walker: 2.0.2 + magic-string: 0.30.5 + dev: true + /@vue/reactivity@3.2.47: resolution: {integrity: sha512-7khqQ/75oyyg+N/e+iwV6lpy1f5wq759NdlS1fpAhFXa8VeAIKGgk2E/C4VF59lx5b+Ezs5fpp/5WsRYXQiKxQ==} dependencies: @@ -4120,6 +4173,14 @@ packages: '@vue/shared': 3.2.47 csstype: 2.6.21 + /@vue/runtime-dom@3.3.13: + resolution: {integrity: sha512-JJkpE8R/hJKXqVTgUoODwS5wqKtOsmJPEqmp90PDVGygtJ4C0PtOkcEYXwhiVEmef6xeXcIlrT3Yo5aQ4qkHhQ==} + dependencies: + '@vue/runtime-core': 3.3.13 + '@vue/shared': 3.3.13 + csstype: 3.1.3 + dev: true + /@vue/server-renderer@3.2.47(vue@3.2.47): resolution: {integrity: sha512-dN9gc1i8EvmP9RCzvneONXsKfBRgqFeFZLurmHOveL7oH6HiFXJw5OGu294n1nHc/HMgTy6LulU/tv5/A7f/LA==} peerDependencies: @@ -4129,6 +4190,16 @@ packages: '@vue/shared': 3.2.47 vue: 3.2.47 + /@vue/server-renderer@3.3.13(vue@3.3.13): + resolution: {integrity: sha512-vSnN+nuf6iSqTL3Qgx/9A+BT+0Zf/VJOgF5uMZrKjYPs38GMYyAU1coDyBNHauehXDaP+zl73VhwWv0vBRBHcg==} + peerDependencies: + vue: 3.3.13 + dependencies: + '@vue/compiler-ssr': 3.3.13 + '@vue/shared': 3.3.13 + vue: 3.3.13(typescript@4.9.5) + dev: true + /@vue/shared@3.2.47: resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==} @@ -5413,6 +5484,10 @@ packages: /csstype@2.6.21: resolution: {integrity: sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==} + /csstype@3.1.3: + resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + dev: true + /currently-unhandled@0.4.1: resolution: {integrity: sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==} engines: {node: '>=0.10.0'} @@ -12490,6 +12565,22 @@ packages: '@vue/server-renderer': 3.2.47(vue@3.2.47) '@vue/shared': 3.2.47 + /vue@3.3.13(typescript@4.9.5): + resolution: {integrity: sha512-LDnUpQvDgsfc0u/YgtAgTMXJlJQqjkxW1PVcOnJA5cshPleULDjHi7U45pl2VJYazSSvLH8UKcid/kzH8I0a0Q==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@vue/compiler-dom': 3.3.13 + '@vue/compiler-sfc': 3.3.13 + '@vue/runtime-dom': 3.3.13 + '@vue/server-renderer': 3.3.13(vue@3.3.13) + '@vue/shared': 3.3.13 + typescript: 4.9.5 + dev: true + /w3c-hr-time@1.0.2: resolution: {integrity: sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==} deprecated: Use your platform's native performance.now() and performance.timeOrigin. diff --git a/src/components.d.ts b/src/components.d.ts index e9ca603..7fa6b1b 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -7,7 +7,7 @@ export {} declare module 'vue' { export interface GlobalComponents { - RouterLink: (typeof import('vue-router'))['RouterLink'] - RouterView: (typeof import('vue-router'))['RouterView'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] } } diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 0d66de1..a7decc8 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -11,6 +11,17 @@ import { ref } from 'vue' import { fun, fun as yy } from '../../test/import-sort' +uni.showModal({ + title: '提示', + content: '这是一个模态弹窗', + success(res) { + if (res.confirm) { + console.log('用户点击确定') + } else if (res.cancel) { + console.log('用户点击取消') + } + }, +}) const title = ref('Hello') fun() yy() diff --git a/tsconfig.json b/tsconfig.json index c6de161..7520ba3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,10 @@ "@/*": ["./src/*"] }, "lib": ["esnext", "dom"], - "types": ["@dcloudio/types"] + "types": ["@dcloudio/types", "@types/wechat-miniprogram", "@uni-helper/uni-app-types"] + }, + "vueCompilerOptions": { + "nativeTags": ["block", "template", "component", "slot"] }, "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], "references": [{ "path": "./tsconfig.node.json" }]