1.1.1 • Published 5 years ago

vue-pic-dragging-yk v1.1.1

Weekly downloads
36
License
-
Repository
-
Last release
5 years ago

Vue.js Grid ( Experiment )

Install

npm install --save vue-pic-drag-yk
import Vue from 'vue'
import Grid from 'vue-pic-drag-yk'
Vue.use(Grid)

Usage

data () {
  return {
    items: [
      'a',
      'b',
      'c'
    ]
}
<grid
  :draggable="true"
  :sortable="true"
  :items="items"
  :height="100"
  :width="100">
  <template slot="cell" scope="props">
    <div>{{props.item}}</div>
  </template>
</grid>

Props

NameTypeDefaultDescription
itemsArray[]Initial array of items
cellWidthNumber80Cell width
cellHeightNumber80Cell height
gridWidthNumber800your container width
draggableBooleanfalseFlag that will let you drag grid's cells
dragDelayNumber0@TODO
sortableBooleanfalseFlag that will let you reorder grid's cells, requires draggable to be true
centerBooleanfalse@TODO

Events

NameDescription
@changeOccurs on every action that involves reordering array or changing it's length
@removeOccurs when an element is deleted through template
@clickOccurs when cell is clicked
@sortOccurs when array item order is changed manually

Cell template

Cell template is used to get access to list data, indexing and sorting params generated by plugin.

Template's scope contains:

props.item - list item value

props.index - initial index of the item

props.sort - current index of an item after sorting

props.remove() - method that will remove item from the arrey and resport list.

Example:

1.1.1

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago