From dcd8f441f8b966452cbfec99390ed137692767aa Mon Sep 17 00:00:00 2001 From: wancat Date: Thu, 27 Jun 2024 12:14:15 +0800 Subject: [PATCH] feat: echo start after creating session --- app/src/components/game/HintPart.vue | 31 +++++++++++++--------------- app/src/store/session.ts | 3 ++- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/src/components/game/HintPart.vue b/app/src/components/game/HintPart.vue index f7faaf4..f3487be 100644 --- a/app/src/components/game/HintPart.vue +++ b/app/src/components/game/HintPart.vue @@ -5,13 +5,18 @@ import MarkdownText from '../MarkdownText.vue' const sessionStore = useSession() const current = ref(-1) -watch( - () => sessionStore.session?.hints, - (hints) => { - current.value = hints ? hints.length - 1 : -1 - }, - { deep: true } -) +const length = computed(() => { + console.log(sessionStore.session?.responses) + return sessionStore.session?.responses.length ?? 0 +}) + +const disabled = computed(() => { + return current.value === length.value - 1 +}) + +watch(length, () => { + current.value = length.value - 1 +}) const left = () => { if (current.value > 0) { @@ -20,18 +25,10 @@ const left = () => { } const right = () => { - if (current.value < (sessionStore.session?.hints.length ?? 0) - 1) { + if (current.value < length.value - 1) { current.value += 1 } } - -const length = computed(() => { - return sessionStore.session?.hints.length ?? 0 -}) - -const disabled = computed(() => { - return current.value === length.value - 1 -})