1.3.0 • Published 8 years ago

cbp-vue-crop v1.3.0

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

cbp-vue-crop

Simple and beauty Image Cropper for Vue

Install

npm install -s cbp-vue-crop

Usage

<template>
    ....
    <cbp-vue-crop ref="cbpVueCrop" :options="options" :img="img"></cbp-vue-crop>
    ....
</template>

<script>
  import cbpVueCrop from '../src/cbp-vue-crop.vue'
  ....
  export default {
    ....
    components: { cbpVueCrop },
    ....
    methods: {
      ....
      onCrop() {
        ....
        let crop = this.$refs.cbpVueCrop.crop();
        ....
      }
      ....
    }
    ....
  }
</script>

Demo

Soon

Development Setup

# install dependencies
$ npm install

# dev mode
$ npm run dev

# test
$ npm run test

# build
$ npm run build

Parameters

options

Object

OptionDescriptionTypeDefault
isCirclePickeris picker area circlebooleantrue
containerSizecontainer size example: {width:900, height:700} or 600object/number600
pickerSizecontainer size example: {width:400, height:200} or 300object/number300
initialScaleinitial scale of pickernumber1
stuckif its true you cann't drag or scale image from picker areabooleantrue
minScaleminimal scale of picker, if stuck option is true, this options won't be usednumber0.2
maxScalemaximal scale of pickernumber2
stepScalestep of scalenumber0.0001
scaleStylevue style of scaleobject{}
containerStylevue style of containerobject{}
pickerStylevue style of pickerobject{}
backgroundColorbackground color of containerstring'#333333'

img

String

Url to image wich u want to crop

Methods

MethodDescriptionReturn TypeExample
cropcrop return coordinates of top left corner and bottom right cornerarray{x:12, y:34}, {x: 567, y:890}
1.3.0

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.2

8 years ago

1.0.0

8 years ago