feat: use useImages composable instead of <img> + useTemplateRef

This commit is contained in:
2025-11-18 21:12:00 +01:00
parent acace6698c
commit ba6eb31b99
18 changed files with 187 additions and 278 deletions

View File

@@ -1,17 +1,13 @@
<script setup lang="ts">
const backgroundImage = useTemplateRef("backgroundImage");
import BACKGROUND_IMAGE from "/assets/images/projects/bottom-screen/background.png";
const [backgroundImage] = useImages(BACKGROUND_IMAGE);
useRender((ctx) => {
if (!backgroundImage.value) return;
ctx.drawImage(backgroundImage!, 0, 0);
});
ctx.drawImage(backgroundImage.value, 0, 0);
defineOptions({
render: () => null,
});
</script>
<template>
<img
ref="backgroundImage"
src="/assets/images/projects/bottom-screen/background.png"
hidden
/>
</template>