xyxiao001 / vue-cropper

A simple picture clipping plugin for vue
https://github.xyxiao.cn/vue-cropper/docs/vue3.html
MIT License
4.3k stars 695 forks source link

只有背景,图片没有加载出来 #108

Closed ThatRoy closed 6 years ago

ThatRoy commented 6 years ago

问题:图片地址有传,基本都是复制 demo ,但是图片没有加载出来,只有马赛克的背景 代码: 外层已经设置一个 div ,以及固定宽高大小 <div style="width:500px;height:500px;"> <vue-cropper ref="cropper2" :img="example2.img" :outputSize="example2.size" :outputType="example2.outputType" :info="example2.info" :canScale="example2.canScale" :autoCrop="example2.autoCrop" :autoCropWidth="example2.autoCropWidth" :autoCropHeight="example2.autoCropHeight" :fixed="example2.fixed" :fixedNumber="example2.fixedNumber"> </vue-cropper> </div> 数据: example2: { img: 'http://ofyaji162.bkt.clouddn.com/bg1.jpg', info: true, size: 1, outputType: 'jpeg', canScale: false, autoCrop: true, // 只有自动截图开启 宽度高度才生效 autoCropWidth: 300, autoCropHeight: 250, // 开启宽度和高度比例 fixed: true, fixedNumber: [4, 3] } 控制台错误日志: index.js?619d:1 Uncaught TypeError: First argument to DataView constructor must be an ArrayBuffer at new DataView (<anonymous>) at h (index.js?619d:1) at o (index.js?619d:1) at MockXMLHttpRequest.i.onload (index.js?619d:1) at MockXMLHttpRequest.dispatchEvent (mock.js?ccd5:8472) at XMLHttpRequest.handle (mock.js?ccd5:8300)

xyxiao001 commented 6 years ago

是不是参数传错了 可以截图报错吗

ThatRoy commented 6 years ago

没想到都乱了,重新处理下。。 代码: image

image

报错: image

ThatRoy commented 6 years ago

你好,是我传参数有问题是吗

xyxiao001 commented 6 years ago

提示是参数有问题 但是代码没问题 你把插件注释掉 看看还有错吗

ThatRoy commented 6 years ago

插件注释掉的话,就不会报这个错

xyxiao001 commented 6 years ago

你可以试一试只传图片 其他参数都不传

ThatRoy commented 6 years ago

去掉 img 属性就不会报错,我再看看