This commit is contained in:
zyronon
2023-08-04 18:56:45 +08:00
parent 8a18bb53fd
commit 321408cd0d
2 changed files with 8 additions and 8 deletions

View File

@@ -51,12 +51,7 @@ onMounted(() => {
let configStr = localStorage.getItem(saveKey)
if (configStr) {
let obj: Config = JSON.parse(configStr)
config.newWords = obj.newWords
config.skipWords = obj.skipWords
config.skipWordNames = obj.skipWordNames
config.dict = obj.dict
config.chapterIndex = obj.chapterIndex
config.wordIndex = 0
store.init(obj)
}
if (config.dict === 'nce2') {
wordList = chunk(NCE_2, 15) as any
@@ -66,7 +61,6 @@ onMounted(() => {
}
}
window.addEventListener('keydown', onKeyDown)
})
@@ -178,7 +172,7 @@ function playAudio() {
<div class="word" :class="wrong&&'is-wrong'">
<span class="input" v-if="input">{{ input }}</span>
<span class="wrong" v-if="wrong">{{ wrong }}</span>
<span class="letter">{{ word.name.slice(input.length + wrong.length) }}</span>
<span class="letter">{{ store.word.name.slice(input.length + wrong.length) }}</span>
</div>
<div class="audio" @click="playAudio">播放</div>
</div>

View File

@@ -21,6 +21,12 @@ export const useBaseStore = defineStore('base', {
},
actions: {
init(config: Config) {
this.newWords = config.newWords
this.skipWords = config.skipWords
this.skipWordNames = config.skipWordNames
this.dict = config.dict
this.chapterIndex = config.chapterIndex
this.wordIndex = 0
},
},
})