oss-wec / wisdm

Wildlife information system for data management
1 stars 1 forks source link

Communicating with vuex from form #7

Closed kissmygritts closed 7 years ago

kissmygritts commented 7 years ago

https://vuex.vuejs.org/en/forms.html recommends using two way computed property between the component and vuex.

computed: {
  message: {
    get () {
      return this.$store.state.obj.message
    },
    set (value) {
      this.$store.commit('updateMessage', value)
    }
  }

However this will require writing one for each field. This doesn't sound appealing.

Not to mention, how can I do this with an dynamic form elements and arrays?

kissmygritts commented 7 years ago

https://ypereirareis.github.io/blog/2017/04/25/vuejs-two-way-data-binding-state-management-vuex-strict-mode/

This article has an interesting implementation.