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