Merge pull request #10 from T1ipoca/fix/crossorigin-image-loads

fix: 跨域托管静态资源时 new Image() 缺少 crossOrigin 导致渲染失败
This commit is contained in:
Ausevay authored and GitHub committed 2026-10-03 14:24:35 +08:00
commit e9e032f7b1
2 files changed
+2

No files matched your search

+1
View File
@@ -417,6 +417,7 @@ export function loadImageElement(url) {
if (typeof Image === 'undefined') { reject(new Error('no Image in this environment')); return; }
const img = new Image();
img.decoding = 'async';
img.crossOrigin = 'anonymous';
img.onload = () => resolve(img);
img.onerror = () => reject(new Error(`image failed: ${url}`));
img.src = url;
+1
View File
@@ -67,6 +67,7 @@ function preload(url) {
if (!url || typeof Image === 'undefined') return;
const img = new Image();
img.decoding = 'async';
img.crossOrigin = 'anonymous';
img.src = url;
}