sunny920406 / vue2-dnd

Drag n' Drop plugin for Vue.js

Home Page:https://jsfiddle.net/jikkai/jy8epmor/3/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vue2-dnd

img img

Drag n' Drop plugin for Vue.js

Demo

jsfiddle

Installation

npm install vue2-dnd --save

Usage

import Vue2Dnd from 'vue2-dnd'

Vue.use(Vue2Dnd)

Draggable Directive

v-draggable.[groupname]="[draggable object]"
<template>
  <div v-draggable.groupname="item"></div>
</template>

<script>
  export default {
    data () {
      return {
        key: item.key,
        name: item.name
      }
    }
  }
</script>

Droppable Directive

v-droppable.[groupname]="[droppable callback function]"
<template>
  <div v-droppable.groupname="callback"></div>
</template>

<script>
  export default {
    methods: {
      callback ($ev) {
        // $ev contains the draggable object
      }
    }
  }
</script>

License

MIT

About

Drag n' Drop plugin for Vue.js

https://jsfiddle.net/jikkai/jy8epmor/3/

License:MIT License


Languages

Language:JavaScript 100.0%