楼主解决了吗
楼主解决没?
var cropperOptions = {
viewMode: 1,
dragMode: 'none',
aspectRatio: 1,
background: false,
autoCropArea: 0.6,
crop: function (event) {
//裁剪的实时事件
console.log(event.detail.width);
console.log(event.detail.height);
},
ready: function () {
//裁剪区域大小
cropperImage.cropper('crop');
cropperImage.cropper('setData', {
width: 400, //指定宽度
height: 400 //指定高度
})
}
};
//上传的图片对象
var cropperImg = new Image();
//组件初始化 ,destroy方法保证正常的重入
cropperImage.cropper('destroy').attr('src', cropperImg.src).cropper(cropperOptions);