Skip to content

Commit c69a7b3

Browse files
committed
use templateRef
1 parent b844bec commit c69a7b3

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/components/TheCycleEdit.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import { computed, ref, watch } from 'vue';
2+
import { computed, ref, useTemplateRef, watch } from 'vue';
33
import IntervalEditBox from '@/components/IntervalEditBox.vue';
44
import BaseButton from '@/components/BaseButton.vue';
55
import BaseIcon from '@/components/BaseIcon.vue';
@@ -41,7 +41,7 @@ function submit() {
4141
close();
4242
}
4343
44-
const dialog = ref<HTMLDialogElement>();
44+
const dialog = useTemplateRef('dialog');
4545
watch(
4646
() => open,
4747
(open: boolean) => {

src/components/TheGraphicTimer.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<script setup lang="ts">
2-
import { watch, ref, onMounted, onUnmounted, computed } from 'vue';
2+
import {
3+
watch,
4+
ref,
5+
onMounted,
6+
onUnmounted,
7+
computed,
8+
useTemplateRef,
9+
} from 'vue';
310
import { number } from 'vue-types';
411
import { getIntervalTypeColor } from '@/utils';
512
import { useCycle } from '@/stores/cycle';
@@ -27,7 +34,7 @@ const { size } = defineProps({
2734
size: number().def(50),
2835
});
2936
30-
const canvasRef = ref<HTMLCanvasElement>();
37+
const canvasRef = useTemplateRef('canvasRef');
3138
const remaining = computed(
3239
() => cycle.currentCountdown ?? cycle.currentInterval.duration,
3340
);

0 commit comments

Comments
 (0)