Skip to content

this code from’Object Change Detection‘ doesn't work #1397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/v2/guide/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ Vue.set(vm.userProfile, 'age', 27)
You can also use the `vm.$set` instance method, which is an alias for the global `Vue.set`:

``` js
vm.$set(this.userProfile, 'age', 27)
vm.$set(vm.userProfile, 'age', 27)
```

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:

``` js
Object.assign(this.userProfile, {
Object.assign(vm.userProfile, {
age: 27,
favoriteColor: 'Vue Green'
})
Expand All @@ -337,7 +337,7 @@ Object.assign(this.userProfile, {
You would add new, reactive properties with:

``` js
this.userProfile = Object.assign({}, this.userProfile, {
vm.userProfile = Object.assign({}, vm.userProfile, {
age: 27,
favoriteColor: 'Vue Green'
})
Expand Down