@@ -45,7 +45,7 @@ export default defineComponent({
45
45
```
46
46
47
47
``` bash
48
- npx tosetup /src/401 .vue
48
+ npx tosetup /src/App .vue
49
49
```
50
50
51
51
** transform code**
@@ -70,7 +70,7 @@ const mySlots = useSlots();
70
70
71
71
const bar = ref (0 );
72
72
emit (" change" );
73
- const expose = defineExpose ({ bar });
73
+ defineExpose ({ bar });
74
74
75
75
76
76
@@ -170,24 +170,10 @@ interface DefaultOption {
170
170
171
171
## Limitations/限制
172
172
173
- Unable to transform spread syntax
174
-
175
- 无法解析展开语法
176
-
177
- ``` js
178
- export default defineComponent ({
179
- name: ' App' ,
180
- directives: {
181
- ... directives
182
- },
183
- emit: [" click" ],
184
- setup (props , { emit, ... options }) {
185
- return {}
186
- }
187
- })
188
- ```
189
173
Unable to transform ` TypeScript-only Features ` of ` defineEmits ` , support only
190
174
175
+ 无法将 ` defineEmits ` 转换为 ` TypeScript-only Features ` 模式,仅支持转换为数组
176
+
191
177
``` ts
192
178
const emit = defineEmits ([' change' , ' delete' ])
193
179
```
@@ -209,8 +195,33 @@ export default {
209
195
export default {
210
196
mounted() {
211
197
// Child.vue is script code, it`s work
212
- // Child.vue is setup code, foo is undefined
198
+ // Child.vue is setup code, foo is undefined, need `expose({ foo })`
213
199
this .$refs .child .foo ()
214
200
}
215
201
}
216
202
```
203
+
204
+ ## Not supported/不支持
205
+
206
+ ``` ts
207
+ export default defineComponent ({
208
+ name: ' App' ,
209
+ ... optoons , // ❌
210
+ directives: {
211
+ ... directives , // ❌
212
+ },
213
+ emit: [" click" ],
214
+ // ...options ❌
215
+ setup(props , { emit , ... options }) {
216
+ const obj = reactive ({ a , b , c })
217
+ options .expose () // ❌
218
+
219
+ const { ... } = toRefs (obj ) // ✅
220
+ function handle() {} // ✅
221
+ return {
222
+ ... toRefs (obj ), // ❌
223
+ handle() {}, // ❌
224
+ }
225
+ }
226
+ })
227
+ ```
0 commit comments