1.0.0 • Published 8 years ago

vue-resize-handle v1.0.0

Weekly downloads
35
License
MIT
Repository
github
Last release
8 years ago

vue-resize-handle

When you want to able to resize an element uni- or bidirectional, you need a resize-handle.

Demo

Install

npm install --save-dev vue-resize-handle

or include build/bundle.js.

Usage

# link the components up
components:
  "resizer": require "vue-resize-handle/unidirectional"
  # or:
  "resizer": require "vue-resize-handle/bidirectional"

# when using the bundle
components:
  "resizer": window.vueComps.resizeHandle.uni
  # or:
  "resizer": window.vueComps.resizeHandle.bi

data: ->
  width: 200
  # or:
  style:
    width: 200
    height: 200
<div :style="{width:width+'px'}">
  <resizer :size.sync="width"></resizer>
</div>
# or
<div :style="style">
  <resizer :size.sync="style"></resizer>
</div>

For examples see dev/.

Props

Both
Nametypedefaultdescription
offsetNumber0how far the handle overlaps the parent
extentNumber10extent of the handle in px
Unidirectional
Nametypedefaultdescription
minSizeNumber0minimal size of the parent
defaultSizeNumber-1default size of the parent (will be set if dblclick on handle)
maxSizeNumberNumber.MAX_VALUEmaximal size of the parent
sideString"right"one of "top","right","bottom","left"
sizeNumber-(two-way) will be updated on resize
Bidirectional
Nametypedefaultdescription
minSizeObject{height:0, width:0}minimal size of the parent
defaultSizeObject{height:-1, width:-1}default size of the parent (will be set if dblclick on handle)
maxSizeObject{height:Number.MAX_VALUE, width:Number.MAX_VALUE}maximal size of the parent
keepRatioBooleanfalseenforce aspect ratio
cornerString"se"one of "se","sw","ne","nw" (cardinal points)
sizeObject{height:0, width:0}(two-way) will be updated on resize

Events

NameArgumentsdescription
resize-startthis.size, thisemitted when resize starts
resizethis.size, oldSize, thisemitted on resize and on reset
resize-endthis.size, thisemitted when resize ends
reset-size-emitted on reset after resize

Development

Clone repository.

npm install
npm run dev

Browse to http://localhost:8080/.

License

Copyright (c) 2016 Paul Pflugradt Licensed under the MIT license.