quiz sentence hide details and stop audio before starting next

This commit is contained in:
polv committed 2026-07-05 12:01:32 +07:00
1 parent eff1227b20
commit 09af058fa1
3 files changed
+26 -1

No files matched your search

+14 -1
View File
@@ -25,7 +25,7 @@
<span class="spoiler"> {{ v.en }} </span>
</div>
<details v-if="example">
<details v-if="example" ref="sdetails">
<summary>
<span v-if="example.audio">
{{ example.ko }}
@@ -69,6 +69,7 @@ const vList = ref<IVoc[]>([]);
const vIndex = ref(0);
const vSentAutoplayAudio = ref(true);
const sentenceDetails = useTemplateRef("sdetails");
const stts = useTemplateRef<InstanceType<typeof TTS>>("stts");
const v = computed(() => vList.value[vIndex.value]);
@@ -99,6 +100,12 @@ vChosenCats.value = [...vCats.value];
makeVList();
function makeVList() {
nextTick(() => {
if (sentenceDetails.value) {
sentenceDetails.value.open = false;
}
});
vList.value = Object.entries(vocabulary)
.filter(([k]) => vChosenCats.value.includes(k))
.flatMap(([, v]) => v);
@@ -113,6 +120,12 @@ function makeVList() {
}
function mark(isRight: boolean) {
nextTick(() => {
if (sentenceDetails.value) {
sentenceDetails.value.open = false;
}
});
if (isRight) {
vList.value = [...vList.value.filter((_, i) => i !== vIndex.value)];
if (vList.value.length === 0) {