From 73e8f6127ce325ddf2673a0f70ca9823c2af7006 Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Mon, 22 Jan 2018 18:04:40 +0800 Subject: [PATCH] =?UTF-8?q?demo=20from=20=E2=80=99Object=20Change=20Detect?= =?UTF-8?q?ion=E2=80=98=20doesn't=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit vm.$set(this.userProfile, 'age', 27) ==> vm.$set(vm.userProfile, 'age', 27); --- src/v2/guide/list.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/v2/guide/list.md b/src/v2/guide/list.md index 6f22436b1f..0c0183bebf 100644 --- a/src/v2/guide/list.md +++ b/src/v2/guide/list.md @@ -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' }) @@ -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' })