其他分享
首页 > 其他分享> > vue 简单的状态管理store

vue 简单的状态管理store

作者:互联网

const store = {
  debug: true,

  state: reactive({
    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 = ''
  }
}

标签:vue,log,state,简单,debug,message,newValue,store
来源: https://blog.csdn.net/weixin_43294560/article/details/122861800