1.安装vue-cropper
使用npm本地安装vue-cropper
npm install vue-cropper --save-dev
2.实现代码
<template>
<div>
<div>
<div class="pos movediv" :style="cutPhotomodel?'z-index:10':'z-index:-5'">
<div class="myheader">
<div>选择图片</div>
<div @click="colorcover"><img src="./images/关闭icon.png" alt=""></div>
</div>
<div class="mymodel">
<div class="cropper">
<vueCropper ref="cropper" :img="option.img?option.img:photosimg" :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" @realTime="realTime"></vueCropper>
</div>
</div>
<div class="mydiv1">
<div :style="previews.img">
<img :src="previews.url">
</div>
</div>
<div class="mydiv2">
<div :style="previews.img">
<img :src="previews.url">
</div>
</div>
<div class="mydiv3">头像预览</div>
<div class=&