MaxLeiter / sortablejs-vue3

A thin wrapper around Sortable.js for Vue 3
https://sortablejs-vue3.maxleiter.com
MIT License
364 stars 20 forks source link

e.preventDefault() not working? #81

Closed quilkin closed 1 year ago

quilkin commented 1 year ago

I am trying to stop a drag from list A to list B (drags from B to A are allowed). I have tried handling both the move and the end events, but cannot prevent them: function checkMove(e) { var c = e.cancelable; if (e.to.dataset.list == "startGrid") e.preventDefault(); } the debugger clearly shows 'preventDefault' being reached, but the move still ocurs. This seems pretty basic; what am I doing wrong here?

MaxLeiter commented 1 year ago

Sorry this isn't documented well yet, but as of https://github.com/MaxLeiter/sortablejs-vue3/pull/56 you can pass @move.capture to the component to return false/true/etc based on your logic. See the PR description for an example.