我有一个场景,包装的元素只有在满足特定条件时才能拖动。我在HTML中是这样处理它的:
<draggable v-if='somePassingConditions'>
<my-component></my-component>
</draggable>
<my-component v-else></my-component>我尽量不将if-else条件放入模板中。有没有办法在Vue.Draggable中启用或禁用拖动功能?谢谢
发布于 2021-06-24 04:24:09
试试这个:
<draggable :disabled='somePassingConditions'>
<my-component></my-component>
</draggable>下面是一个来自draggable offical repo的例子:https://github.com/SortableJS/vue.draggable.next/blob/master/example/components/simple.vue
此外,此链接可能会有所帮助:https://sortablejs.github.io/vue.draggable.next/#/simple
https://stackoverflow.com/questions/68106527
复制相似问题