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 RFC**](https://composition-api.vuejs.org/)
8
+
English | [中文](./README.zh-CN.md)·[**Composition API Docs**](https://composition-api.vuejs.org/)
9
9
10
+
</p>
10
11
11
-
**Note: the primary goal of this package is to allow the community to experiment with the API and provide feedback before it's finalized. The implementation may contain minor inconsistencies with the RFC as the latter gets updated. We do not recommend using this package for production yet at this stage.**
// because TypeScript can't tell this is options for a Vue component.
75
-
};
57
+
}
76
58
```
77
59
78
-
## TSX
60
+
###TSX
79
61
80
62
:rocket: An Example [Repository](https://github.com/liximomo/vue-composition-api-tsx-example) with TS and TSX support is provided to help you start.
81
63
@@ -102,13 +84,23 @@ declare global {
102
84
}
103
85
```
104
86
105
-
# Limitations
87
+
## Limitations
88
+
89
+
> :white_check_mark:
90
+
> Support :x: Not Supported
91
+
92
+
### Performance Impact
93
+
94
+
Due the the limitation of Vue2's public API. `@vue/composition-api` inevitably introduced some extract costs. This should not concern you in most of the cases.
106
95
107
-
## `Ref` Unwrap
96
+
You can check the [benchmarks](https://antfu.github.io/vue-composition-api-benchmark-results/) that comparing with Vue 2's option API and vue-next.
108
97
109
-
`Unwrap` is not working with Array index.
110
98
111
-
### **Should not** store `ref` as a **direct** child of `Array`:
99
+
### `Ref` Unwrap
100
+
101
+
:x:`Unwrap` is not working with Array index.
102
+
103
+
#### **Should NOT** store `ref` as a **direct** child of `Array`:
112
104
113
105
```js
114
106
conststate=reactive({
@@ -122,7 +114,7 @@ state.list.push(ref(1));
122
114
state.list[1].value===1; // true
123
115
```
124
116
125
-
### **Should not** use `ref` in a plain object when working with `Array`:
117
+
####**Should NOT** use `ref` in a plain object when working with `Array`:
126
118
127
119
```js
128
120
consta= {
@@ -149,7 +141,7 @@ const b = reactive({
149
141
b.list[0].count.value===0; // true
150
142
```
151
143
152
-
### **Should** always use `ref` in a `reactive` when working with `Array`:
144
+
####**Should** always use `ref` in a `reactive` when working with `Array`:
153
145
154
146
```js
155
147
consta=reactive({
@@ -170,23 +162,18 @@ b.list.push(
170
162
b.list[1].count===1; // true
171
163
```
172
164
173
-
### ***Using***`reactive` will mutate the origin object
174
-
175
-
This is an limitation of using `Vue.observable` in Vue 2.
176
-
> Vue 3 will return an new proxy object.
165
+
### :warning:`reactive`***mutates*** the original object
177
166
178
-
---
167
+
`reactive` uses `Vue.observable` underneath which will ***mutate*** the original object.
179
168
180
-
## `watch()` API
169
+
> :bulb: Vue 3 will return an new proxy object.
181
170
182
-
`onTrack` and `onTrigger` are not available in `WatchOptions`.
183
171
184
-
---
172
+
### `watch()` API
185
173
186
-
## Template Refs
174
+
:x:`onTrack` and `onTrigger` are not available in `WatchOptions`.
187
175
188
-
> :white_check_mark:
189
-
> Support :x: Not Supported
0 commit comments