Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added capture modifier support onMove event #56

Merged
merged 5 commits into from
Dec 27, 2022
Merged

Added capture modifier support onMove event #56

merged 5 commits into from
Dec 27, 2022

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?

src/components/Sortable.vue Outdated Show resolved Hide resolved
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.

None yet

2 participants