I want to change cursor while dragging the element. PLease help!!!!
I want too !!! I figured out we cannot do it easily because of the css pointer-event: none set on the style of the sortable-chosen item... Anyone have a workaround ?
For those who will end up here. I found those issues that helpt me
I finally manage to change the cursor while dragging by adding a class on the <html/>.
Here a simple example :
global.css
.grabbing * {
cursor: grabbing !important;
}
myComponent.vue
<draggable
draggable=".draggable"
group="properties"
filter=".ignore-draggable"
:forceFallback="true"
:preventOnFilter="false"
@end="onDragEnd"
@start="onStart"
>
[...]
onDragEnd: function(e): void {
const className = 'grabbing';
const html = document.getElementsByTagName('html').item(0);
if (html && new RegExp(className).test(html.className) === true) {
// Remove className with the added space (from setClassToHTMLElement)
html.className = html.className.replace(
new RegExp(' ' + className),
''
);
// Remove className without added space (just in case)
html.className = html.className.replace(new RegExp(className), '');
}
}
onStart: function() {
const className = 'grabbing';
const html = document.getElementsByTagName('html').item(0);
if (html && new RegExp(className).test(html.className) === false) {
html.className += ' ' + className; // use a space in case there are other classNames
}
}
@sarahLardeau thanks for documenting your solution.
@sarahLardeau 3q锛実ood boy 銆傛杩庢潵鍥涘窛
Most helpful comment
For those who will end up here. I found those issues that helpt me
I finally manage to change the cursor while dragging by adding a class on the
<html/>.Here a simple example :
global.cssmyComponent.vue