|
8 | 8 | - [@uni-helper/uni-cloud-types](https://github.com/uni-helper/uni-cloud-types) 提供 `uni-cloud` 组件类型
|
9 | 9 | - [@uni-helper/uni-ui-types](https://github.com/uni-helper/uni-ui-types) (当前仓库)提供 `uni-ui` 组件类型
|
10 | 10 |
|
11 |
| -基于 [这个 PR](https://github.com/vuejs/core/pull/3399),[Vue Language Features (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) 已经支持。 |
| 11 | +基于 [这个 PR](https://github.com/vuejs/core/pull/3399),[Vue - Official](https://marketplace.visualstudio.com/items?itemName=Vue.volar)(即 Volar) 已经支持。 |
12 | 12 |
|
13 |
| -安装之后,建议启用 [接管模式 Takeover Mode](https://cn.vuejs.org/guide/typescript/overview.html#volar-takeover-mode)。如果不想启用接管模式,可以安装 [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin)。启用或安装后需要重启 VSCode。 |
| 13 | +安装之后,请参考 [这里](https://cn.vuejs.org/guide/typescript/overview.html) 配置你的 VS Code。启用或安装后需要重启 VS Code。 |
14 | 14 |
|
15 | 15 | 维护直到官方类型推出。
|
16 | 16 |
|
|
25 | 25 | - 安装依赖
|
26 | 26 |
|
27 | 27 | ```shell
|
28 |
| - npm i -D @uni-helper/uni-ui-types |
| 28 | + npm i -D @uni-helper/uni-app-types @uni-helper/uni-ui-types |
29 | 29 | ```
|
30 | 30 |
|
31 | 31 | <details>
|
|
38 | 38 | <p>请参考 <a href="https://pnpm.io/npmrc#shamefully-hoist">文档</a> 设置 <code>shamefully-hoist</code> 为 <code>true</code>。</p>
|
39 | 39 | </details>
|
40 | 40 |
|
41 |
| -- 配置 `tsconfig.json`,确保 `compilerOptions.types` 中含有 `@dcloudio/types` 和 `@uni-helper/uni-ui-types` 且 `include` 包含了对应的 `vue` 文件 |
| 41 | +- 配置 `tsconfig.json`,确保 `compilerOptions.types` 中含有 `@dcloudio/types`、`@uni-helper/uni-app-types` 和 `@uni-helper/uni-ui-types`,且 `include` 包含了对应的 `vue` 文件 |
42 | 42 |
|
43 | 43 | <details>
|
44 |
| - <summary>1.7.12 <= <code>Vue Language Features (Volar)</code> & <code>vue-tsc</code></summary> |
| 44 | + <summary>2.0.14 <= <code>Vue Language Features (Volar)</code> & <code>vue-tsc</code></summary> |
45 | 45 |
|
46 | 46 | ```json
|
47 | 47 | {
|
48 | 48 | "compilerOptions": {
|
49 |
| - "types": ["@dcloudio/types", "@uni-helper/uni-ui-types"] |
| 49 | + "types": [ |
| 50 | + "@dcloudio/types", |
| 51 | + "@uni-helper/uni-app-types", |
| 52 | + "@uni-helper/uni-ui-types" |
| 53 | + ] |
| 54 | + }, |
| 55 | + "vueCompilerOptions": { |
| 56 | + "plugins": ["@uni-helper/uni-app-types/volar-plugin"] |
| 57 | + }, |
| 58 | + "include": ["src/**/*.vue"] |
| 59 | + } |
| 60 | + ``` |
| 61 | + |
| 62 | + </details> |
| 63 | + |
| 64 | + <details> |
| 65 | + <summary>1.7.12 <= <code>Vue Language Features (Volar)</code> & <code>vue-tsc</code> <= 2.0.13</summary> |
| 66 | + |
| 67 | + ```json |
| 68 | + { |
| 69 | + "compilerOptions": { |
| 70 | + "types": [ |
| 71 | + "@dcloudio/types", |
| 72 | + "@uni-helper/uni-app-types", |
| 73 | + "@uni-helper/uni-ui-types" |
| 74 | + ] |
50 | 75 | },
|
51 | 76 | "vueCompilerOptions": {
|
52 | 77 | "nativeTags": ["block", "component", "template", "slot"]
|
|
58 | 83 | </details>
|
59 | 84 |
|
60 | 85 | <details>
|
61 |
| - <summary>1.5.1 <= <code>Vue Language Features (Volar)</code> & <code>vue-tsc</code></summary> |
| 86 | + <summary>1.5.1 <= <code>Vue Language Features (Volar)</code> & <code>vue-tsc</code> < 1.7.12</summary> |
62 | 87 |
|
63 | 88 | ```json
|
64 | 89 | {
|
65 | 90 | "compilerOptions": {
|
66 |
| - "types": ["@dcloudio/types", "@uni-helper/uni-ui-types"] |
| 91 | + "types": [ |
| 92 | + "@dcloudio/types", |
| 93 | + "@uni-helper/uni-app-types", |
| 94 | + "@uni-helper/uni-ui-types" |
| 95 | + ] |
67 | 96 | },
|
68 | 97 | "include": ["src/**/*.vue"]
|
69 | 98 | }
|
|
77 | 106 | ```json
|
78 | 107 | {
|
79 | 108 | "compilerOptions": {
|
80 |
| - "types": ["@dcloudio/types", "@uni-helper/uni-ui-types"] |
| 109 | + "types": [ |
| 110 | + "@dcloudio/types", |
| 111 | + "@uni-helper/uni-app-types", |
| 112 | + "@uni-helper/uni-ui-types" |
| 113 | + ] |
81 | 114 | },
|
82 | 115 | "vueCompilerOptions": {
|
83 | 116 | "nativeTags": ["block", "component", "template", "slot"]
|
|
94 | 127 | ```json
|
95 | 128 | {
|
96 | 129 | "compilerOptions": {
|
97 |
| - "types": ["@dcloudio/types", "@uni-helper/uni-ui-types"] |
| 130 | + "types": [ |
| 131 | + "@dcloudio/types", |
| 132 | + "@uni-helper/uni-app-types", |
| 133 | + "@uni-helper/uni-ui-types" |
| 134 | + ] |
98 | 135 | },
|
99 | 136 | "vueCompilerOptions": {
|
100 | 137 | "experimentalRuntimeMode": "runtime-uni-app"
|
@@ -135,7 +172,7 @@ import { ref } from 'vue';
|
135 | 172 |
|
136 | 173 | const type = ref<UniHelper.UniBadgeType>('default');
|
137 | 174 | const onClick: UniHelper.UniBadgeOnClick = (event) => {
|
138 |
| - ... |
| 175 | + // ... |
139 | 176 | };
|
140 | 177 | </script>
|
141 | 178 |
|
|
0 commit comments