Skip to content

Commit c9d2dba

Browse files
authored
docs: update Readme
1 parent 1e8164b commit c9d2dba

File tree

1 file changed

+30
-19
lines changed

1 file changed

+30
-19
lines changed

README.md

+30-19
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default defineComponent({
4545
```
4646

4747
```bash
48-
npx tosetup /src/401.vue
48+
npx tosetup /src/App.vue
4949
```
5050

5151
**transform code**
@@ -70,7 +70,7 @@ const mySlots = useSlots();
7070
7171
const bar = ref(0);
7272
emit("change");
73-
const expose = defineExpose({ bar });
73+
defineExpose({ bar });
7474
7575
7676
@@ -170,24 +170,10 @@ interface DefaultOption {
170170

171171
## Limitations/限制
172172

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-
```
189173
Unable to transform `TypeScript-only Features` of `defineEmits`, support only
190174

175+
无法将 `defineEmits` 转换为 `TypeScript-only Features` 模式,仅支持转换为数组
176+
191177
```ts
192178
const emit = defineEmits(['change', 'delete'])
193179
```
@@ -209,8 +195,33 @@ export default {
209195
export default {
210196
mounted() {
211197
// 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 })`
213199
this.$refs.child.foo()
214200
}
215201
}
216202
```
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

Comments
 (0)