Vue.Draggable icon indicating copy to clipboard operation
Vue.Draggable copied to clipboard

Nested example with Vuex throws error when nesting, but not when reordering top level

Open jifka opened this issue 4 years ago • 3 comments

I've followed the example using a Vuex store for elements, and implemented a getter/setter for the list that reads/writes the store. This is in the outermost component holding the top-level nested vue. The v-model is assigned to the afformentioned list.

This works properly if the list is flat and items can be dragged to reorder.

But as soon as you attempt to drag an item within another to create a hierarchy, the standard error is thrown: "[vuex] do not mutate vuex store state outside mutation handlers."

I can't seem to figure out how to catch an attempt to add/remove child elements in order to update the store using commit or dispatch.

jifka avatar May 08 '21 15:05 jifka

v-model should not be used for updating the store.... i know i have this issue too and havent tried to resolve while using this component in other items of my web app i have used :value instead and got rid of the error

JamieGarcia123 avatar Nov 24 '21 13:11 JamieGarcia123

Having the same issue, :value has some strange behavior too. It starts duplicating items 🤷‍♂️

jakecjones avatar Dec 14 '21 14:12 jakecjones

Check out the potential solution from issue #701

jakecjones avatar Dec 14 '21 14:12 jakecjones