[v4] Validation with Vuex #3180
Answered
by
logaretm
christopherlumsden
asked this question in
Q&A
-
Is anyone able to offer guidance / a design pattern / an example of how to handle validation with Vuex? For example <template>
<form>
<input type="text" :value="name" @input="setName" />
<input type="text" :value="address" @input="setAddress" />
</form>
</template>
<script>
import { mapState, mapMutations } from "vuex";
export default {
computed: {
...mapState(["name","address"])
},
methods: {
...mapMutations({
setName: "UPDATE_NAME",
setAddress: "UPDATE_ADDRESS",
}
}
}
</script> I've taken a look at the components introduction and the API reference but they both use examples with Apologies in advance if this is a newbie question; I'm relatively new to vee-validate! |
Beta Was this translation helpful? Give feedback.
Answered by
logaretm
Feb 19, 2021
Replies: 1 comment 3 replies
-
You could use "two-way computed properties" to use "v-model" with your state/mutations Generally, I'm not a fan of using Vuex for forms. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
logaretm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could use "two-way computed properties" to use "v-model" with your state/mutations
Generally, I'm not a fan of using Vuex for forms.