vue-electron / vuex-electron

Integration of Vuex and Electron
MIT License
305 stars 96 forks source link

Feature: Add get/set mapping to store fields. #13

Open SGarno opened 5 years ago

SGarno commented 5 years ago

One of the missing capabilities of Vuex is the ability to do two-way v-model binding directly from the store object (you have to write your own setter and getter for each store object). If your form is extensive, that is a lot of unnecessary coding.

One solution I use in standard (non-electron) vue applications is vuex-map-fields. It allows you to bind to a store field directly with v-model when you just need a simple set/get.

Your computed v-model-friendly property becomes:

    computed: {
      ...mapFields([
        'firstName',
        'lastName',
        'email',
        'phone',
        'address1',
        'address2',
        'city',
        'state',
        'zipcode'
      ]),

It would be VERY handy to have this same capability (using dispatch) built into vuex-electron. :smiley:

akodkod commented 5 years ago

@SGarno it's an excellent suggestion, but unfortunately, I don't have enough time to implement this at the moment. But feel free to open a pull request with such functionality, I would be happy to merge it 😉

akodkod commented 5 years ago

https://github.com/vue-electron/vuex-electron/issues/44