What does simple state management on vue's official website mean?

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

Aug.10,2021
The

example is actually quite complete. If you call store.state, on vmA and vmB, you give them the public state object {message:'Hello'}. When you call store.setMessageAction ('world'), you will find that the sharedState of vmA and vmB has changed from Hello to world, so you can achieve the common state


, which means that two people use the same bank card

.
Menu