6 Star 51 Fork 10

Gitee 极速下载 / vue-draggable

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/SortableJS/Vue.Draggable
克隆/下载
Vue.draggable.for.ReadME.md 1.45 KB
一键复制 编辑 原始数据 按行查看 历史

For Vue.js 1.0

Use it exactly as v-for directive, passing optional parameters using 'options' parameter. Options parameter can be json string or a full javascript object.

<div v-dragable-for="element in list1" options='{"group":"people"}'>
  <p>{{element.name}}</p>
</div>

Limitation

  • This directive works only when applied to arrays and not to objects.
  • onStart, onUpdate, onAdd, onRemove Sortable.js options hooks are used by v-dragable-for to update VM. As such these four options are not usable with v-dragable-for. If you need to listen to re-order events, you can watch the underlying view model collection. For example:
        watch: {
            'list1': function () {
                console.log('Collection updated!');
            },

fiddle

Simple: https://jsfiddle.net/dede89/j62g58z7/

Two Lists: https://jsfiddle.net/dede89/hqxranrd/

Example with list clone: https://jsfiddle.net/dede89/u5ecgtsj/

Installation

  • Available through:
 npm install vuedraggable
 Bower install vue.draggable

Version 1.0.9 is Vue.js 1.0 compatible

  • For Modules

    // ES6  
    //For Vue.js 1.0 only
    import VueDraggable from 'vuedraggable'
    import Vue from 'vue'
    Vue.use(VueDraggable)
    
    // ES5 
    //For Vue.js 1.0
    var Vue = require('vue')
    Vue.use(require('vuedraggable'))
  • For <script> Include

    Include 'vue.dragable.for' after Vue and lodash(version >=3).

JavaScript
1
https://gitee.com/mirrors/vue-draggable.git
git@gitee.com:mirrors/vue-draggable.git
mirrors
vue-draggable
vue-draggable
master

搜索帮助