0👍
✅
methods: { // my component
...mapMutations(['setContactListName']), //import function from the store
viewHandler(id, item) { // hadler
this.$router.push(`/company/sample-contact/${id}`);
this.setContactListName(item); // pass data to the function
}
}
or using this.$store.commit
methods: { // my component
viewHandler(id, item) { // hadler
this.$router.push(`/company/sample-contact/${id}`);
this.$store.commit('setContactListName', item);
}
}
Source:stackexchange.com