2024-03-15 Vue 生成海报的插件vue-canva

2024-03-14  本文已影响0人  半眼鱼

报错信息,请求的url就是报错的那个url
Access to image at 'http://test-trip-plus.oss-cn-shenzhen.aliyuncs.com/2020/4/19/19/5/57ovib7tyx2gaqfmio2ose8.jpg' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
fail失败的回调报错信息:
fail-this.template 失败的参数 TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLImageElement or SVGImageElement or HTMLVideoElement or HTMLCanvasElement or ImageBitmap or OffscreenCanvas)' at Painter._drawAbsImage (vue-canvas-poster.umd.js?33a5:4319) at Painter._drawAbsolute (vue-canvas-poster.umd.js?33a5:3942) at Painter.paint (vue-canvas-poster.umd.js?33a5:3882) at eval (vue-canvas-poster.umd.js?33a5:4770)
后台阿里云oss跨域配置是*,尝试后还是不行

解决方法1 图片使用base64
方法二

最后的解决是在url中加上一个后缀时间戳,保证让其走非缓存。http:img.png/v=Math.Random()
上一篇下一篇

猜你喜欢

热点阅读