Open Silence-dream opened 1 year ago
// 预加载图片 let count = 0; let imgs = [].concat(homeSrcList, protagonistList); for (let img of imgs) { let image = new Image(); image.src = img; image.onload = () => { count++; if (count === imgs.length - 1) { console.log("图片加载完成"); } }; }