1.1.1 • Published 3 years ago

vue-light-drag v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

vue-light-drag

Lightweight drag and drop components

install

yarn add vue-light-drag 或者 npm install vue-light-drag

引入

import Vue from 'vue';
import Drag from 'vue-light-drag';

Vue.use(Drag);

demo

<template>
    <div>
        <Drag
            style="width: 200px"
            :list="list1"
            :config="config1"
        >
            <template v-slot="{ item }">
                <div class="item">
                    {{ item.name }}
                </div>
            </template>
        </Drag>

        <Drag
            style="width: 200px"
            :list="list2"
            :config="config2"
        >
            <template v-slot="{ item }">
                <div class="item">
                    {{ item.name }}
                </div>
            </template>
        </Drag>
    </div>
</template>

<script>
export default {
    name: 'App',

    data() {
        return {
            list1: new Array(10).fill(0).map((_, i) => ({
                name: `列表1 - ${i + 1}`,
                draggable: true,
            })),

            config1: {
                name: 'test',
                push: true,
                pull: true,
                exchange: true,
            },

            list2: new Array(10).fill(0).map((_, i) => ({
                name: `列表2 - ${i + 1}`,
                draggable: true,
            })),

            config2: {
                name: 'test',
                push: true,
                pull: true,
                exchange: true,
            },
        };
    },
};
</script>

Attributes

参数说明类型可选值默认值
list渲染列表Array-[]
config.name跨列表关联名string-''
config.uuidField唯一属性字段名string-'id'
config.push当前列表是否支持从其他列表push元素进来booleantrue
config.pull将当前列表的某个元素拖拽并添加到其他列表里,该元素是否从当前列表移除booleantrue
config.exchange当前列表元素之间是否支持交换位置booleantrue

Events

事件名称说明回调参数
drag-start-index
drag-enter-index
drag-over-index
drag-end-

交流 1215901037@qq.com

1.1.1

3 years ago

1.1.0

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago