lesson 14 grammar, example sent manual random

This commit is contained in:
polv committed 2026-07-25 10:24:28 +07:00
1 parent 614432579b
commit 5b4e32b8b9
2 files changed
+276 -10

No files matched your search

+35 -10
View File
@@ -49,6 +49,15 @@
:spoiler="!isKoFirst"
ref="saud"
/>
<button
type="button"
name="new-sentence"
v-if="v.examples && v.examples.length > 1"
@click="makeNewExIndex()"
style="margin-inline-start: 0.5em"
>
↻
</button>
</summary>
<SentenceAudio v-if="example" :v="example" lang="en" />
<blockquote v-if="v.notes" :class="$style.notes">
@@ -216,6 +225,19 @@ function makeVList() {
exIndex.value = ex ? Math.floor(Math.random() * ex.length) : 0;
}
function makeNewExIndex() {
if (v.value.examples && v.value.examples.length > 1) {
const newValue = Math.floor(Math.random() * (v.value.examples.length - 1));
exIndex.value = newValue >= exIndex.value ? newValue + 1 : newValue;
nextTick(() => {
if (saud.value && isAutoplayAudio.value) {
saud.value.playAudio();
}
});
}
}
function mark(isRight: boolean) {
nextTick(() => {
if (sentenceDetails.value) {
@@ -361,17 +383,19 @@ onMounted(async () => {
});
}
const newVList = Object.entries(vocabulary)
.filter(([k]) => vChosenCats.value.includes(k))
.flatMap(([, vs]) => vs);
// const newVList = Object.entries(vocabulary)
// .filter(([k]) => vChosenCats.value.includes(k))
// .flatMap(([, vs]) => vs);
vList.value = vListOriginalIndex.value
.map((o, i) => {
o.s = newVList[i] || o.s;
return o;
})
.sort((a, b) => a.k - b.k)
.map((o) => o.s);
// vList.value = vListOriginalIndex.value
// .map((o, i) => {
// o.s = newVList[i] || o.s;
// return o;
// })
// .sort((a, b) => a.k - b.k)
// .map((o) => o.s);
makeVList();
});
onBeforeUnmount(() => {
@@ -388,6 +412,7 @@ onBeforeUnmount(() => {
}
}
.notes {
div + div,
p + p {
margin-top: 0.5em !important;
}