vue-dragula

:ok_hand: Drag and drop so simple it hurts http://astray-git.github.io/vue-dragula

  • 所有者: Astray-git/vue-dragula
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    2
      比較:

Github星跟蹤圖

vue-dragula

:ok_hand: Drag and drop so simple it hurts

Vue wrapper for [dragula][1].

Install

CommonJS

  • Available through npm as vue-dragula.

    npm install vue-dragula
    
    var Vue = require('vue');
    var VueDragula = require('vue-dragula');
    
    Vue.use(VueDragula);
    

Direct include

  • You can also directly include it with a <script> tag when you have Vue and dragula already included globally. It will automatically install itself.

Usage

template:

<div class="wrapper">
  <div class="container" v-dragula="colOne" bag="first-bag">
    <!-- with click -->
    <div v-for="text in colOne" @click="onClick">{{text}} [click me]</div>
  </div>
  <div class="container" v-dragula="colTwo" bag="first-bag">
    <div v-for="text in colTwo">{{text}}</div>
  </div>
</div>

NOTE Vuejs 2.x

To make sure a correct update for DOM element order, we must provide a key for v-for directive inside a dragula container. https://vuejs.org/v2/guide/list.html#key
With v-for="item in list", we need :key="item.id" for object items, :key="item" for plain string.

APIs

You can access them from Vue.vueDragula

options(name, options)

Set dragula options, refer to: https://github.com/bevacqua/dragula#optionscontainers

...
new Vue({
  ...
  created: function () {
    Vue.vueDragula.options('my-bag', {
      direction: 'vertical'
    })
  }
})

find(name)

Returns the bag for a drake instance. Contains the following properties:

  • name the name that identifies the bag
  • drake the raw drake instance

Events

For drake events, refer to: https://github.com/bevacqua/dragula#drakeon-events

...
new Vue({
  ready: function () {
    Vue.vueDragula.eventBus.$on('drop', function (args) {
      console.log('drop: ' + args[0])
    })
  }
})

Special Events for vue-dragula, Event Name, Listener Arguments, Event Description, :-------------:, :-------------:, -----, dropModel, bagName, el, target, source, dropIndex, model was synced, dropIndex exposed, removeModel, bagName, el, container, removeIndex, model was synced, removeIndex exposed, [1]: https://github.com/bevacqua/dragula

主要指標

概覽
名稱與所有者Astray-git/vue-dragula
主編程語言JavaScript
編程語言JavaScript (語言數: 5)
平台
許可證MIT License
所有者活动
創建於2016-04-26 07:19:15
推送於2021-03-24 10:56:30
最后一次提交2020-10-14 11:17:27
發布數10
最新版本名稱2.0.0-alpha.1 (發布於 )
第一版名稱0.0.2 (發布於 )
用户参与
星數359
關注者數8
派生數69
提交數49
已啟用問題?
問題數35
打開的問題數18
拉請求數8
打開的拉請求數3
關閉的拉請求數5
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?