demo-int-table/admin_front/pages/plan/mark.vue

17 lines
550 B
Vue

<script setup lang="ts">
const canvasElement: Ref<HTMLCanvasElement | undefined> = ref();
const context: Ref<CanvasRenderingContext2D | undefined> = ref();
onMounted(async () => {
const plan = useState('plan')
console.log(plan)
context.value = canvasElement.value?.getContext('2d') || undefined;
if (context.value) {
plan.value.paths.forEach(path => {
context.value.stroke(new Path2D(path));
});
}
})
</script>
<template>
<canvas ref="canvasElement" width="1200" height="1000"></canvas>
</template>