mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: close hint for new responses
This commit is contained in:
1 parent
beb58e233e
commit
876cae6947
1 file changed
+8
-1
@@ -5,6 +5,7 @@ import MarkdownText from '../MarkdownText.vue'
|
||||
|
||||
const sessionStore = useSession()
|
||||
const current = ref(-1)
|
||||
const hintDetails = ref<HTMLDetailsElement | null>(null)
|
||||
const length = computed(() => {
|
||||
return sessionStore.session?.responses?.length ?? 0
|
||||
})
|
||||
@@ -36,6 +37,12 @@ const response = computed(() => {
|
||||
if (current.value >= sessionStore.session.responses.length) return null
|
||||
return sessionStore.session.responses[current.value]
|
||||
})
|
||||
|
||||
watch(response, () => {
|
||||
if (hintDetails.value) {
|
||||
hintDetails.value.open = false
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -89,7 +96,7 @@ const response = computed(() => {
|
||||
v-if="response?.hint"
|
||||
class="text-text-primary font-xl whitespace-pre-wrap"
|
||||
>
|
||||
<details>
|
||||
<details ref="hintDetails">
|
||||
<summary class="cursor-pointer">提示</summary>
|
||||
<MarkdownText :content="response.hint" />
|
||||
</details>
|
||||
|
||||
Reference in new issue
Block a user