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
⚠️ <code>set</code> and <code>del</code> workaround for adding and deleting reactive properties
187
-
</summary>
188
-
189
-
> ⚠️ Warning: `set` and `del` do NOT exist in Vue 3. We provide them as a workaround here, due to the limitation of [Vue 2.x reactivity system](https://vuejs.org/v2/guide/reactivity.html#For-Objects).
190
-
>
191
-
> 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.
192
-
>
193
-
> Similarly, in Vue 2 you will need to call `del` to [ensure a key deletion triggers view updates](https://vuejs.org/v2/api/#Vue-delete) in reactive objects (similar to `Vue.delete` but for `reactive objects` created by the Composition API). In Vue 3 you can just delete them by calling `delete foo.bar`.
194
-
195
-
```ts
196
-
import { reactive, set } from'@vue/composition-api'
197
-
198
-
const a =reactive({
199
-
foo: 1
200
-
})
201
-
202
-
// add new reactive key
203
-
set(a, 'bar', 1)
204
-
205
-
// remove a key and trigger reactivity
206
-
del(a, 'bar')
207
-
```
208
-
209
-
</details>
210
-
211
184
### Template Refs
212
185
213
186
<details>
@@ -362,6 +335,33 @@ export default {
362
335
363
336
</details>
364
337
338
+
<details>
339
+
<summary>
340
+
⚠️ <code>set</code> and <code>del</code> workaround for adding and deleting reactive properties
341
+
</summary>
342
+
343
+
> ⚠️ Warning: `set` and `del` do NOT exist in Vue 3. We provide them as a workaround here, due to the limitation of [Vue 2.x reactivity system](https://vuejs.org/v2/guide/reactivity.html#For-Objects).
344
+
>
345
+
> 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.
346
+
>
347
+
> Similarly, in Vue 2 you will need to call `del` to [ensure a key deletion triggers view updates](https://vuejs.org/v2/api/#Vue-delete) in reactive objects (similar to `Vue.delete` but for `reactive objects` created by the Composition API). In Vue 3 you can just delete them by calling `delete foo.bar`.
348
+
349
+
```ts
350
+
import { reactive, set } from'@vue/composition-api'
0 commit comments