This commit is contained in:
zyronon
2023-10-17 01:53:33 +08:00
parent e229a1dee0
commit ef486c545c
4 changed files with 332556 additions and 161593 deletions

View File

@@ -75,7 +75,19 @@ watch(() => data.index, (n) => {
}
})
let allList = $ref([])
const word = $computed(() => {
let w = data.words[data.index]
let s = allList.find(s => s.name === w.name)
if (s) return s
else return w ?? {
trans: [],
name: '',
usphone: '',
ukphone: '',
}
return data.words[data.index] ?? {
trans: [],
name: '',
@@ -96,10 +108,17 @@ let resetWord = $computed(() => {
return word.name.slice(input.length + wrong.length)
})
onMounted(() => {
emitter.on(EventKey.resetWord, () => {
wrong = input = ''
})
fetch('./dicts/coca20000.json').then(r => {
r.json().then(v => {
console.log('v', v)
allList = v
})
})
})
function next(isTyping: boolean = true) {
@@ -314,7 +333,8 @@ useOnKeyboardEventListener(onKeyDown, onKeyUp)
fontSize: settingStore.fontSize.wordTranslateFontSize +'rem',
opacity: settingStore.translate ? 1 : 0
}"
>{{ word.trans.join('') }}
>
<div v-for="i in word.trans">{{i}}</div>
</div>
<div class="word-wrapper">
<div class="word"