mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +08:00
16 lines
393 B
TypeScript
16 lines
393 B
TypeScript
|
/* eslint-disable import/prefer-default-export */
|
||
|
|
||
|
export function preLoad(list: string[]) {
|
||
|
if (typeof window !== 'undefined') {
|
||
|
// 图处预加载;
|
||
|
const div = document.createElement('div');
|
||
|
div.style.display = 'none';
|
||
|
document.body.appendChild(div);
|
||
|
list.forEach(src => {
|
||
|
const img = new Image();
|
||
|
img.src = src;
|
||
|
div.appendChild(img);
|
||
|
});
|
||
|
}
|
||
|
}
|