A Vue wrapper component for cropperjs.
Checkout here agontuk.github.io/vue-cropperjs
npm install --save vue-cropperjs
For Vue 1.0, use
npm install --save vue-cropperjs@1.0.3
You will also need css & style loader for webpack
// Global
import Vue from 'vue';
import VueCropper from 'vue-cropperjs';
import 'cropperjs/dist/cropper.css';
Vue.component(VueCropper);
// Local
import VueCropper from 'vue-cropperjs';
import 'cropperjs/dist/cropper.css';
export default {
components: { VueCropper}
}
...
<vue-cropper
ref="cropper"
:src="imgSrc"
alt="Source Image"
@ready="..."
@cropstart="..."
@cropmove="..."
@cropend="..."
@crop="..."
@zoom="..."
>
</vue-cropper>
...
this.$refs.cropper.rotate(45);
See the example files & cropperjs documentation
Name | Type | Required | Description |
---|---|---|---|
src | string |
-- | Image source |
containerStyle | object |
-- | Styling for the image container |
imgStyle | object |
-- | Styling for the image |
alt | string |
-- | Alternate text for the image |
See cropperjs documentation for all posible options & methods.
relativeZoom
fromzoom
initCrop
fromcrop
MIT