You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
English | [中文](./README.zh-CN.md) ・ [**Composition API Docs**](https://composition-api.vuejs.org/)
12
10
13
11
## Installation
@@ -181,7 +179,7 @@ a.list[1].count === 1 // true
181
179
182
180
<details>
183
181
<summary>
184
-
⚠️ `set` workaround for adding new reactive properties
182
+
⚠️ <code>set</code> workaround for adding new reactive properties
185
183
</summary>
186
184
187
185
> ⚠️ Warning: `set` does NOT exist in Vue 3. We provide it as a workaround here, due to the limitation of [Vue 2.x reactivity system](https://vuejs.org/v2/guide/reactivity.html#For-Objects). In Vue 2, you will need to call `set` to track new keys on an `object`(similar to `Vue.set` but for `reactive objects` created by the Composition API). In Vue 3, you can just assign them like normal objects.
const { bar } =toRefs(props.foo) // it will `warn`
430
-
431
-
// use this instead
428
+
429
+
// use this instead
432
430
const { foo } =toRefs(props)
433
431
const a =foo.value.bar
434
432
}
@@ -437,8 +435,6 @@ defineComponent({
437
435
438
436
</details>
439
437
440
-
441
-
442
438
### Missing APIs
443
439
444
440
The following APIs introduced in Vue 3 are not available in this plugin.
@@ -469,6 +465,31 @@ export default {
469
465
470
466
</details>
471
467
468
+
### `emit` Options
469
+
470
+
<details>
471
+
<summary>
472
+
❌ <code>emit</code> option is provided in type-level only, in order to align with Vue 3's type interface. Does NOT have actual effects on the code.
473
+
</summary>
474
+
475
+
```ts
476
+
defineComponent({
477
+
emit: {
478
+
// has no effects
479
+
submit: (eventOption) => {
480
+
if (...) {
481
+
returntrue
482
+
} else {
483
+
console.warn('Invalid submit event payload!')
484
+
returnfalse
485
+
}
486
+
}
487
+
}
488
+
})
489
+
```
490
+
491
+
</details>
492
+
472
493
### Performance Impact
473
494
474
495
Due the the limitation of Vue2's public API. `@vue/composition-api` inevitably introduced some extract costs. It shouldn't bother you unless in extreme environments.
0 commit comments