replace onUpdate to watch in Canvas.vue
This commit is contained in:
parent
cd99acf726
commit
0019ab3020
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue