如何才能让<input>的v-model和vuex中的数据快速绑定上?

HTML:

<input v-model="test">

JS:

computed: {
  test: {
    get () {
      return this.$store.state.test
    },
    set (val) {
      this.$store.commit('setTest', val)
    }
  }
}

posted @ 2018-03-05 10:57  潘多拉Pandora  阅读(287)  评论(0编辑  收藏  举报