Skip to content

Conversation

@YahorDanchanka
Copy link
Contributor

Now added support for returning values on onMove method.

<Sortable item-key="id" :list="items" @move.capture="onMove">
  <template #item="{element, index}">
    <div class="draggable" :key="element.id">
      {{ element.value }}
    </div>
  </template>
</Sortable>
<script lang="ts" setup>
// now we can return next values to realize some logic 
function onMove() {
  // return false; — for cancel
  // return -1; — insert before target
  // return 1; — insert after target
  // return true; — keep default insertion point based on the direction
  // return void; — keep default insertion point based on the direction
  return false
}
</script>

@vercel
Copy link

vercel bot commented Dec 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
sortablejs-vue3 ✅ Ready (Inspect) Visit Preview Dec 27, 2022 at 9:14PM (UTC)

Copy link
Owner

@MaxLeiter MaxLeiter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much! I pushed a small commit adding a comment linking here. Would you mind updating the README's Events section?

Copy link
Owner

@MaxLeiter MaxLeiter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@MaxLeiter MaxLeiter merged commit 43bd3fe into MaxLeiter:main Dec 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants