Answer the question
In order to leave comments, you need to log in
How to update a variable in a component from store?
in the modal I write the selected category to the store like this
getCategory(category) {
this.$store.commit('categories/SELECT_CATEGORY', category)
},
export const state = () => ({
categories: [],
category: [],
})
export const mutations = {
SELECT_CATEGORY(state, category) {
state.category = category
},
}
data(){
return{
category_id: 0
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question