项目作者: jikkai

项目描述 :
Drag n' Drop plugin for Vue.js
高级语言: JavaScript
项目地址: git://github.com/jikkai/vue2-dnd.git
创建时间: 2016-12-21T07:07:20Z
项目社区:https://github.com/jikkai/vue2-dnd

开源协议:MIT License

下载


vue2-dnd

img
img

Drag n’ Drop plugin for Vue.js

Demo

jsfiddle

Installation

  1. npm install vue2-dnd --save

Usage

  1. import Vue2Dnd from 'vue2-dnd'
  2. Vue.use(Vue2Dnd)

Draggable Directive

  1. v-draggable.[groupname]="[draggable object]"
  1. <template>
  2. <div v-draggable.groupname="item"></div>
  3. </template>
  4. <script>
  5. export default {
  6. data () {
  7. return {
  8. key: item.key,
  9. name: item.name
  10. }
  11. }
  12. }
  13. </script>

Droppable Directive

  1. v-droppable.[groupname]="[droppable callback function]"
  1. <template>
  2. <div v-droppable.groupname="callback"></div>
  3. </template>
  4. <script>
  5. export default {
  6. methods: {
  7. callback ($ev) {
  8. // $ev contains the draggable object
  9. }
  10. }
  11. }
  12. </script>

License

MIT