vue 图片跨域问题解决
let image = new Image();let that = this;image.crossOrigin = '';image.src = url;image.src = url + '?time=' + new Date().valueOf();// 允许跨域操作image.setAttribute('crossOrigin', 'anonymous');image.o...
·
let image = new Image(); let that = this; image.crossOrigin = ''; image.src = url; image.src = url + '?time=' + new Date().valueOf(); // 允许跨域操作 image.setAttribute('crossOrigin', 'anonymous'); image.onload = function() { let base64 = that.getBase64Image(image); let img2 = that.convertBase64UrlToBlob(base64); if (type === 1) that.changeKoubeiImg(1, img2); if (type === 2) that.changeKoubeiImg(2, img2); };
setAttribute 解决了图片跨域问题,记录下
更多推荐
已为社区贡献1条内容
所有评论(0)