0👍
I am still learning about Vuex as well, so hopefully my answer will be able to help you.
If your route is projects/:id
, you can easily get the id by this.$route.params.id
in your ‘Add Todo’ method. Then you can pass the id into your mutation, and search the projects by id.
Your method:
methods: {
submitInitialTodo() {
// your mutation for Vuex
this.addInitialTodo(this.$route.params.id);
}
}
In your mutation:
mutations: {
addInitialTodo(state, project_id) {
// search project list by id and push to array
}
}
- [Vuejs]-Correct NodeJS server for Vue.js application
- [Vuejs]-VueJs showing/rendering only one object at a time from a response of 100s of objects
Source:stackexchange.com