Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

vue-pic-drag-yk

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-pic-drag-yk

vue图片拖拽组件

latest
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

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:

.liimg { cursor: pointer; width: 120px; height:120px; background: #fff; position: relative; border:1px solid rgba(120, 130, 140, 0.3); img { width:60px; height:60px; float: left; border-radius:50%; margin-left: 30px; margin-top:10px; } span { width:120px; text-align: center; line-height: 20px; // margin-left: 50px; margin-top: 72px; display: block; font-size:12px; } p { font-size:12px; text-align: center; } .ab{ position: absolute; left:0; top:0; bottom:0; right: 0; cursor: pointer; } .sortnum { position: absolute; left:10px; top:10px; } }

Keywords

vue

FAQs

Package last updated on 11 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts