[Vuejs]-How to add/extend an object in a component

2👍

You have to use set like this:

this.$set(this.myObject, 'newKey', { cool: 'its my new object' })

You could use Object.assign too:

let newObject = { newKey: { cool: 'its my new object' }}
this.myObject = Object.assign({}, this.myObject, newObject)

More: https://v2.vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats

👤pirs

0👍

Well, I asked too soon. I found the following documentation that answers my question. "Object Change Detection Caveats," found here: https://v2.vuejs.org/v2/guide/list.html

Leave a comment