17 lines
311 B
TypeScript
17 lines
311 B
TypeScript
export const useImages = (...paths: string[]) => {
|
|
const images = paths.map((path) => {
|
|
const img = document.createElement("img");
|
|
img.src = path;
|
|
return img;
|
|
});
|
|
|
|
onBeforeUnmount(() => {
|
|
images.forEach((img) => {
|
|
img.src = "";
|
|
img.remove();
|
|
});
|
|
});
|
|
|
|
return images;
|
|
};
|