Skip to content

Commit 54e70b6

Browse files
frankwang0909chrisvfritz
authored andcommitted
demo from ’Object Change Detection‘ doesn't work (#1397)
vm.$set(this.userProfile, 'age', 27) ==> vm.$set(vm.userProfile, 'age', 27);
1 parent c4b7f9a commit 54e70b6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/v2/guide/list.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,13 @@ Vue.set(vm.userProfile, 'age', 27)
322322
You can also use the `vm.$set` instance method, which is an alias for the global `Vue.set`:
323323

324324
``` js
325-
vm.$set(this.userProfile, 'age', 27)
325+
vm.$set(vm.userProfile, 'age', 27)
326326
```
327327

328328
Sometimes you may want to assign a number of new properties to an existing object, for example using `Object.assign()` or `_.extend()`. In such cases, you should create a fresh object with properties from both objects. So instead of:
329329

330330
``` js
331-
Object.assign(this.userProfile, {
331+
Object.assign(vm.userProfile, {
332332
age: 27,
333333
favoriteColor: 'Vue Green'
334334
})
@@ -337,7 +337,7 @@ Object.assign(this.userProfile, {
337337
You would add new, reactive properties with:
338338

339339
``` js
340-
this.userProfile = Object.assign({}, this.userProfile, {
340+
vm.userProfile = Object.assign({}, vm.userProfile, {
341341
age: 27,
342342
favoriteColor: 'Vue Green'
343343
})

0 commit comments

Comments
 (0)