ide/state-management.html" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.
to solve this problem, we adopt a simple store pattern:
var store = {
debug: true,
state: {
message: "Hello!"
},
setMessageAction (newValue) {
if (this.debug) console.log("setMessageAction triggered with", newValue)
this.state.message = newValue
},
clearMessageAction () {
if (this.debug) console.log("clearMessageAction triggered")
this.state.message = ""
}
}
var vmA = new Vue({
data: {
privateState: {},
sharedState: store.state
}
})
var vmB = new Vue({
data: {
privateState: {},
sharedState: store.state
}
})
this example is incomplete and I don"t understand how to use it