With Vuex:
state:{
myObject:{list:[]}
}
<draggable v-model='myObject.list'>
computed: {
myList: {
get() {
return this.$store.state.myObject.list
},
set(value) {
//there is doesn't working!!!!!
this.$store.commit('updateList', value)
}
}
}
Please create a jsfiddle.
@David-Desmaisons done
Also facing this issue. To add a bit more context to the issue, quite simply the setter is not being called and vuex will complain about trying to modify state without mutators
You have to use a computed for the array like this脟
https://jsfiddle.net/dede89/pdnxc01r/2/
I am also having some issues with this.
I am using a computed get() and set() to update some values in my store. However I am not exactly sure what is happening here.
the following code works, but it would mean i might need to have a ton of computed getters and setters.
<draggable class="list-group" v-model="scrumdata" group="scrum" @change="log">
<v-card v-for="element in scrumdata" :key="element.id">{{ element.name }}</v-card>
</draggable>
```js
computed: {
scrumdata: {
get() {
return this.$store.getters.currentScrumData.scrum.todo;
},
set(val) {
console.log(val, "ok");
}
}
}
this works. [todo getter returns an array of objects] and calls the set(val) when the list changes
The following DOES NOT call the set(val) and I can't figure out why!
```html
<draggable class="list-group" v-model="scrumdata.todo" group="scrum" @change="log">
<v-card v-for="element in scrumdata.todo" :key="element.id">{{ element.name }}</v-card>
</draggable>
computed: {
scrumdata: {
get() {
return this.$store.getters.currentScrumData.scrum;
},
set(val) {
console.log(val, "ok");
}
}
}