1.1.2 • Published 6 years ago

vue-crop-avatar v1.1.2

Weekly downloads
10
License
MIT
Repository
-
Last release
6 years ago

TOC

vue-crop-avatar

A vue plugin for crop avatar with cropperjs

Getting started

installation

# install dependencies
npm install vue-crop-avatar

Include files:

import VueAvatar from 'vue-crop-avatar'

Usage

example

<template>
	<vue-crop-avatar
		:isRound=true
		:cropBoxBorderColor="'#666'"
		:defaultImgPath="../../static/logo.png"
		@getrawdata="getCanvasData"
	></vue-crop-avatar>
</template>
<script>
import VueCropAvatar from 'vue-crop-avatar'
export default{
    components:{
        VueCropAvatar
    }
}
</script>

Props

PropTypeDefaultDescription
isRoundBooleanfalseThe shape of cropper box
cropBoxBorderColorString‘#39F’The color of cropper box border
cropBoxBorderWidthNumber1The width of cropper box border
outlineNumber1Is show the outline of cropper box border ,only 1 or 0
defaultImgPathStringnullThe path of image when show the component first time
defaultBgColorString'#39F'The background color if no defaultImgPath
minCropWidthNumber100The min width of cropper box that allow to adjust
minCropHeightNumber100The min height of cropper box that allow to adjust
minFileSizeNumber10*1024The min size of uploaded image
maxCropWidthNumber500The max width of cropper box that allow to adjust
maxCropHeightNumber500The max height of cropper box that allow to adjust
maxFileSizeNumber10*1024*1024The max size of uploaded image
aspectRatioNumber1The aspectRatio of cropper box, other value can be 16/9,4/3
outputTypeString'image/png'The output type of cropper image
beforeOpenFunctionnullA function that will be called before dynamic generate the cropper box
beforeCloseFunctionnullA function that will be called before the cropper box closed

Events

EventTypeDefaultDescription
getrawdataFunction-An event that emitted when crop the canvas, return value is cropped canvas
fileuploaderrFunction-An event emitted when file size largger than maxFileSize or smaller than minFileSize, return value is true or false
1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago