replace onUpdate to watch in Canvas.vue

This commit is contained in:
Вячеслав Нагель 2023-07-12 13:34:53 +07:00
parent cd99acf726
commit 0019ab3020
Signed by: v9gel
GPG Key ID: 7C2360915BE4C743
1 changed files with 2 additions and 6 deletions

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, onUpdated, ref } from "vue";
import { onMounted, ref, watch } from "vue";
import { ONE_MM } from "../const";
import { useStore } from "../store";
import { storeToRefs } from "pinia";
@ -106,17 +106,13 @@ onMounted(() => {
render();
});
onUpdated(() => {
watch(store, () => {
render();
});
</script>
<template>
<canvas id="canvas" :width="imageWidth * ONE_MM" :height="imageHeight * ONE_MM" />
<!-- Костыль, чтобы обновлялся стейт, неужели vue не может красиво это делать -->
<div style="display: none;">
{{ store }}
</div>
</template>
<style scoped>