Skip to content

Commit a9fe0df

Browse files
committed
add tip about assigning properties
1 parent 04c1186 commit a9fe0df

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/guide/reactivity.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ Vue.set(data, 'c', 3)
5050
// `vm.c` and `data.c` are now reactive
5151
```
5252

53+
Sometimes you may want to assign a number of properties on to an existing object, for example using `Object.assign()` or `_.extend()`. However, new properties added to the object will not trigger changes. In such cases, create a fresh object with properties from both the original object and the mixin object:
54+
55+
``` js
56+
// instead of `Object.assign(this.someObject, { a: 1, b: 2 })`
57+
this.someObject = Object.assign({}, this.someObject, { a: 1, b: 2 })
58+
```
59+
5360
There are also a few Array-related caveats, which were [discussed earlier in the list rendering section](/guide/list.html#Caveats).
5461

5562
## Initialize Your Data

0 commit comments

Comments
 (0)