0.1.7 • Published 5 years ago

vue-dnd-lx v0.1.7

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

vue-dnd-lx

Makes your elements draggable in Vue.

Some of goals of this project worth noting include:

  • support mobile
  • Vue data-driven philosophy
  • Supports Vue 2.0+

Requirements

  • Vue: ^2.0.0+

Install

From npm:

$ npm install vue-dnd-lx --save

Usage

//main.js

import VueDND from 'vue-dnd-lx'

Vue.use(VueDND)
<!--your.vue-->
<script>
export default {
  data () {
    return {
        images: [
          {src: 'xxxx', name: 'xxxx'},
          {src: 'xxxx', name: 'xxxx'},
          {src: 'xxxx', name: 'xxxx'},
          {src: 'xxxx', name: 'xxxx'},
          {src: 'xxxx', name: 'xxxx'}
        ]
    }
  }
}
</script>

<template>
  <div class="color-list">
      <div 
          class="color-item" 
          v-for="(item, index) in images" 
          v-dragging="{ list: images, key: 'src',  group: 'group_01' }"
          :key="index">
          <img :src="item.src" />
          <div class="title">{{item.name}}</div>
      </div>
  </div>
</template>

<style lang="less">
/* 需要自定义拖拽图片的样式 */
  .fn-hide{display: none;}
  .vue_dnd_img {
    position: absolute;
    width: 5rem;
    height: 5rem;
    z-index: 100;
    box-shadow: 0 0 0.3rem 5px #3B5999;
    border-radius: 5px;
  }
</style> 

API

v-dragging="{ list: images, key: 'src', group: 'group_01' }"

Arguments:

  • {list} Array: 拖拽图片数组
  • {key} String: 拖拽图片每项图片url的key
  • {group} String: 拖拽图片组名(唯一的),可以有多个组

    group is unique name of multiple dragable lists. key is the key of each photo.

License

The MIT License

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago