-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcropper.vue
51 lines (50 loc) · 1.49 KB
/
cropper.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<template>
<vue-cropper class="cropper" ref="cropper" :src="src" :aspectRatio="option.aspectRatio" :viewMode="option.viewMode"
:dragMode="option.dragMode" :cropBoxResizable="option.cropBoxResizable" :img="option.img" :outputSize="option.size"
:outputType="option.outputType" :info="true" :full="option.full" :canMove="option.canMove"
:canMoveBox="option.canMoveBox" :original="option.original" :autoCrop="option.autoCrop"
:autoCropWidth="option.autoCropWidth" :autoCropHeight="option.autoCropHeight" :fixedBox="option.fixedBox">
</vue-cropper>
</template>
<script>
import VueCropper from 'vue-cropperjs'
import 'cropperjs/dist/cropper.css'
export default {
props: {
src: {
type: String,
default: '',
},
},
data() {
return {
option: {
img: '',
outputSize: 1, //剪切后的图片质量(0.1-1)
full: false, //输出原图比例截图 props名full
outputType: 'png',
cropBoxResizable: false, //是否可以重置
canMove: true,
dragMode: 'move',
original: false,
canMoveBox: true,
autoCrop: true,
autoCropWidth: 350,
autoCropHeight: 200,
minContainerWidth: 350,
minContainerHeight: 200,
minCropBoxWidth: 350,
minCropBoxHeight: 200,
minCanvasWidth: 350,
minCanvasHeight: 200,
aspectRatio: 1, //长宽比例
fixedBox: true,
viewMode: 1,
},
}
},
components: {
VueCropper,
},
}
</script>