-
Notifications
You must be signed in to change notification settings - Fork 2.9k
No Vue 3 support #935
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
Comments
Not sure it's related to vue3 - but in my vue3 app I get "Uncaught (in promise) TypeError: scopedSlot is undefined" in vuedraggable.common.js |
I've been having a lot os problems with Vue3 too. Had this |
This plugin seems to work though: https://github.com/anish2690/vue-draggable-next |
Hello, I will start working on this this week-end. Closing this issue as dup of issue #881 |
in vue 3 you should use draggable library as below: install: impotr: use: and this is the link with full examples: |
Its not working |
It's work.Thanks. |
Just tried this today, with Vue 3, using as per readme's installation/instructions. Getting |
@MostafaSaadatnia Maybe it's related to your #item name |
it worked for me, thanks <3 |
Be sure you are using the word "element" |
Works like charm. I am just finding it difficult to use with nested components, example: App.vue<draggable v-model="agregator.bookmarks" ghost-class="ghost" group="people" @start="drag=true" @end="dragEnded" :move="checkMove" item-key="id">
<bookmark-card #item="{element}">
<!-- component is loaded here, expecting to render -->
</bookmark-card>
</draggable> BookmarkCard.vue<!-- <template #item="{element}"> < This does not work! -->
<template>
<li class="p-2 mb-3 m-1.5 flex items-center bg-gray-900 shadow rounded-lg single-bookmark hover:bg-green-500">
<div class="items-center">
<span class="absolute text-white font-small text-sm">{{ element.bookmark_name}}</span>
</div>
</li>
</template>
<script>
export default {
components: {
// extra few other components
},
props: {
bookmark: {
type: Object,
default: () => ({})
}
},
methods: {
editBookmark() {
this.$parent.editBookmarkParent(this.element);
},
}
}
</script> This does not work and I am getting |
Just quick update with solution for probelm above and nested components. Again I am using VUE 3 here. App.vue<draggable v-model="agregator.bookmarks" ghost-class="ghost" group="people" @start="drag=true" @end="dragEnded" :move="checkMove" item-key="id">
<template #item="{element}">
<bookmark-card :bookmark="element">
</bookmark-card>
</template>
</draggable> The key part is adding Then it can be used inside of component as: BookmarkCard.vue<template>
<li class="p-2 mb-3 m-1.5 flex items-center bg-gray-900 shadow rounded-lg single-bookmark hover:bg-green-500">
<div class="items-center">
<button @click="editBookmark" type="button" class="bookmark-edit h-6 w-6 text-white bg-green-700 dark:hover:bg-green-800 font-medium rounded-lg text-sm text-center dark:bg-green-600 dark:hover:bg-gray-600">
<svg class="w-4 h-4 dark:text-white m-2" fill="none" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z"></path>
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
</svg>
</button>
<span class="absolute text-white font-small text-sm">{{ bookmark.bookmark_name}}</span>
</div>
</li>
</template>
<script>
import Avatar from "vue3-avatar";
export default {
components: {
Avatar,
},
props: {
bookmark: {
type: Object,
default: () => ({})
}
},
methods: {
editBookmark() {
// To exit draggable component and reach App.vue parent method, add $parent.$parent twice
this.$parent.$parent.editBookmarkParent(this.bookmark);
},
}
}
</script>
|
I don't understand where i should put that for the nested list (the link just point the repo, not even the example folder). |
I just did...
|
|
Update version of vuedraggable. "vuedraggable": "4.1.0" |
In Vue 3 the following error appears:
Would be nice to have Vue 3 support.
The text was updated successfully, but these errors were encountered: