Giter Club home page Giter Club logo

Comments (7)

David-Desmaisons avatar David-Desmaisons commented on July 28, 2024 3

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.

rokumatsumoto avatar rokumatsumoto commented on July 28, 2024 1

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.

mathlet0x avatar mathlet0x commented on July 28, 2024

Thanks @David-Desmaisons

from vue.draggable.

Sect0R avatar Sect0R commented on July 28, 2024

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.

HildePedroni avatar HildePedroni commented on July 28, 2024

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.

Sect0R avatar Sect0R commented on July 28, 2024

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.

HildePedroni avatar HildePedroni commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.