Q-Select, Toggle, and emitting events
-
I recently tried to pass an array from Vuex state into a q-select component of type ‘toggle’ and noticed that the select-component modifies the array in place without emitting events. This obviously breaks the Vuex pattern and prevents me from doing this:
skills: { get () { return this.$store.getters['ALL_SKILLS'] }, set (values) { this.$store.commit('SET_SKILLS', values) } }
To work around this I created a local array in the component itself and then watch that array for changes. If there’s a change, I call the Vuex mutation. This solution works, but is there a way I can get the above code to work with q-select of type ‘toggle’?
-
I am also wondering about this - any neat solutions?
-
Use
@change
event. On change, commit to the store.