Open
Description
I am using the Vue.Draggable package and i want to set my own component as container based on property tag
.
It should work fine with strings like (div, span etc.), also with third-party components like el-collapse
.
But it doesn't work with custom components which wasn't registered globally.
My suggestion, make it possible to provide custom component as variable (result of import function). Should work like this:
<template>
<draggable v-model="list" :tag="CustomWrapper">
<div v-for="el in list" :key="el.id">{{el.name}}</div>
</draggable>
</template>
import Draggable from 'vuedraggable'
export default {
name: 'CustomName',
props: { list: Array },
data: () {
return {
CustomWrapper: () => import('./some-path/CustomWrapper')
}
},
components: { Draggable }
}
and here is my custom-wrapper.vue
just in case:
<template>
<div class="custom-wrapper"><slot /></div>
</template>
<script>
export default {
name: "CustomWrapper"
}
</script>