Comments (7)
Hi @mathlet0x , you can use draggable option to use a class for the draggable items. You can use vue class binding to set this class for the draggeble element.
from vue.draggable.
You can use like this, thanks @David-Desmaisons
draggable_file_list.vue
<template>
<div v-if="hasFiles">
<draggable v-model="draggableList" draggable=".js-draggable-file-list-item" animation=200>
<draggable-file-list-item
.
.
draggable_file_list_item.vue
<template>
<div class="up-container" :class="{ 'js-draggable-file-list-item': !isLoading }">
.
.
from vue.draggable.
Thanks @David-Desmaisons
from vue.draggable.
If you have :options - you must set draggable to the options attibute
<draggable class="draggable__container" v-if="isRenderInfo" :list="sortedBoardCard"
v-model="sortedBoardCard"
:options="{
group: 'people',
draggable: '.active'
}"
@end="onDraggableEnd" :move="onDraggableMove">
<transition-group class="draggable__area">
<div class="draggable__element" v-for="card in sortedBoardCard" @click="newTab(card)"
from vue.draggable.
None of the options above worked for me.
<draggable
:list="sections"
:options="{ draggable: '.js-draggable-file-list-item' }"
@change="checkChange">
<div v-for="section in sections" :key="section.id">
<my-section
:section-name="section.name"
:the-id="theId"
:class="{'js-draggable-file-list-item': !isDraggable(section.name)}"
></my-section>
</div>
</draggable>
Is there something wrong?
from vue.draggable.
None of the options above worked for me.
<draggable :list="sections" :options="{ draggable: '.js-draggable-file-list-item' }" @change="checkChange"> <div v-for="section in sections" :key="section.id"> <my-section :section-name="section.name" :the-id="theId" :class="{'js-draggable-file-list-item': !isDraggable(section.name)}" ></my-section> </div> </draggable>
Is there something wrong?
nope. It must works. Did you check the return of "isDraggable" method?
Maybe we have different versions?
I use "^2.16.0"
I found this hack in the 'vuedraggable' code:
var options = _extends({}, this.options, optionsAdded, { onMove: function onMove(evt, originalEvent) {
return _this3.onDragMove(evt, originalEvent);
} });
!('draggable' in options) && (options.draggable = '>*');
this._sortable = new Sortable(this.rootContainer, options);
this.computeIndexes();
from vue.draggable.
Interesting, my version is 2.24.0
isDraggable is returning the expected value.
So, If I understand the use correctly it will allow the drag when the item has the js-draggable-file-list-item
class.
If this is the expected behaviour, then I'm not sure what is going on.
Inspecting the elements, it has the class applied the way I want.
from vue.draggable.
Related Issues (20)
- Has anyone found a solution for Max depth nesting with vue-draggable? If there is any parameter for setting the maximum depth in the nested solution?
- 判断被拖拽元素是否在目标区域内并阻止拖拽
- TypeError: Cannot read properties of undefined (reading 'class')
- Draggable preventing scroll behavior HOT 1
- [feature request] typing for `change` event
- Has this project stopped updating and maintaining
- New draggable under maintenance HOT 1
- Incorrect display of the sheet after dragend HOT 2
- npm i -S vuedraggable 直接报错
- VueDraggable only @choose @unchoose events only getting triggered in vue2.7.15 version
- Please set the `latest` npm tag to v4
- Not working with Socket.io
- How to disable draggable in vue draggable HOT 1
- How to import nested-draggable component ? Vue2
- Triggering drag and drop programmatically
- Missing required prop: "itemKey"
- how to lock vuedraggable for specific array nested level
- Nested Draggable Input with v-model automatically blurs
- Incorrect Visual Representation After Transferring All Items Between Groups
- Address :force-fallback="true" Issue in Cross-List Drag and Drop Cloning with vue-draggable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue.draggable.