fix(ui): sharedData watchers

This commit is contained in:
Guillaume Chau
2018-06-14 01:30:05 +02:00
parent 2239e56351
commit f486d7e5e7
@@ -32,6 +32,14 @@ export default {
}
},
beforeCreate () {
Object.defineProperty(this, '$sharedData', {
get: () => this.$data.$sharedData,
enumerable: true,
configurable: true
})
},
created () {
const options = this.$options.sharedData
if (options) {
@@ -48,6 +56,11 @@ export default {
} else {
this.$syncSharedData(options)
}
// Force watchers to re-evaluate
// Because we just added the proxies to this.$data.$sharedData[key]
this._watchers.forEach(watcher => {
watcher.update()
})
}
},