1
0
mirror of https://github.com/robonen/canvas-3d.git synced 2026-03-20 10:54:39 +00:00

feat(components): HtmlElementEvent type and canvas testing

This commit is contained in:
2022-11-20 04:52:31 +07:00
parent c4ea966e94
commit eec4d3d061
8 changed files with 606 additions and 576 deletions

18
src/components/board.vue Normal file
View File

@@ -0,0 +1,18 @@
<script setup lang="ts">
const canvas = ref<HTMLCanvasElement | null>(null);
onMounted(() => {
if (!canvas.value) return;
const ctx = canvas.value.getContext("2d");
if (!ctx) return;
ctx.fillStyle = "red";
ctx.fillRect(0, 0, Math.random() * 100, Math.random() * 100);
});
</script>
<template>
<canvas ref="canvas" />
</template>