Open fend25 opened 6 years ago
I found a solution.
First, make the root vue component accessible (for example, via window
)
window.$root = new Vue({
el: ...,
data: {store},
...
})
Then, use normal vue's $set
method:
$root.$set($root.store, 'key', value)
//or, for a second level:
$root.$set($root.store.key, 'otherKey', value)
And we are able again to access the store: store.key.otherKey = 'anotherValue' then vue re-renders fine and completely itself, no any $forceUpdate needed.
@cklmercer, I could extend the readme with this approach. Are you interested?
Hi! Very nice library and I am using it for a long time. Thank you! One question: is there any way to add new key or sub key to store? Maybe something like
store.$set('key.subkey', value)
?