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:
18
src/components/board.vue
Normal file
18
src/components/board.vue
Normal 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>
|
||||
Reference in New Issue
Block a user