-
Notifications
You must be signed in to change notification settings - Fork 86
-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: Combine @State and @Mutation into a @Computed annotation #40
Comments
Could we add a @Setter annotation here so we don't have to use the native get/set? |
what would that look like? not sure what you are proposing |
oh, I just saw the mapGetters helper (https://vuex.vuejs.org/guide/getters.html#the-mapgetters-helper) maybe what I actually want is a mapSetters as well? |
There is another library that allows for two-way-binding of simple form fields to store variables BUT it does not support typescript: https://github.com/maoberlehner/vuex-map-fields There is a real gap in the community for this feature. |
Found an easy workaround for now using @change:
|
@jacklp @JavascriptMick If you're still interested, I just stumbled on the same issue for one of my project, and I just published a tiny library for 2 way binding : https://github.com/scleriot/vuex-class-state2way |
sweet, will try and see if I can implement it |
worked beautifully @scleriot |
@jacklp Awesome! |
Is @scleriot 's state2way lib part of vuex-class now? |
This should really be part of the library. |
Still waiting for this new feature... what's happening to the project? |
I am trying to bind a checkbox to my Vuex Store. My understanding is that I need to use v-model:-
<b-form-checkbox id="onlyMineFilterCheckbox" v-model="onlyMineFilter">Show only Mine</b-form-checkbox>
To do the binding, I need to create a computed property on my component class. I can either do this...
or, this ..
The first option uses the vuex-class annotations which is consistent with the rest of my component, but it is verbose and the state/mutation members are only used once. The second option is less verbose but forces me to use $store directly, with the declaration of $store just to fool typescript which I don't like.
What would be best, I think would be if the state accessor and the mutation could be combined into a single annotation... something like this...
What do we think? I am happy to attempt the implementation if we think it is a good design.
The text was updated successfully, but these errors were encountered: