Fixed a bug where the toggle dictionary could not load words
This commit is contained in:
@@ -133,7 +133,6 @@ onMounted(() => {
|
||||
emitter.on(ShortcutKey.ToggleTheme, toggleTheme)
|
||||
emitter.on(ShortcutKey.ToggleConciseMode, toggleConciseMode)
|
||||
emitter.on(ShortcutKey.TogglePanel, togglePanel)
|
||||
practiceRef.getCurrentPractice()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
@@ -44,13 +44,10 @@ watch([
|
||||
// () => store.load,
|
||||
() => store.currentDict.articles,
|
||||
], n => {
|
||||
console.log('n', n)
|
||||
getCurrentPractice()
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
getCurrentPractice()
|
||||
})
|
||||
onMounted(getCurrentPractice)
|
||||
|
||||
function setArticle(val: Article) {
|
||||
store.currentDict.articles[store.currentDict.chapterIndex] = cloneDeep(val)
|
||||
@@ -218,13 +215,15 @@ function changePracticeArticle(val: {
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({getCurrentPractice})
|
||||
const settingStore = useSettingStore()
|
||||
|
||||
const {
|
||||
isArticleCollect,
|
||||
toggleArticleCollect
|
||||
} = useArticleOptions()
|
||||
|
||||
defineExpose({getCurrentPractice})
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -20,25 +20,27 @@ let wordData = $ref({
|
||||
})
|
||||
|
||||
watch([
|
||||
() => store.load,
|
||||
() => store.currentDict.words,
|
||||
], n => {
|
||||
getCurrentPractice()
|
||||
})
|
||||
|
||||
function getCurrentPractice() {
|
||||
// console.log('store.currentDict',store.currentDict)
|
||||
if (store.currentDict.translateLanguage === 'common') {
|
||||
if (store.chapter.length) {
|
||||
wordData.words = store.chapter
|
||||
wordData.index = 0
|
||||
|
||||
store.chapter.map((w: Word) => {
|
||||
let res = runtimeStore.translateWordList.find(a => a.name === w.name)
|
||||
if (res) w = Object.assign(w, res)
|
||||
if (!w.trans.length){
|
||||
let res = runtimeStore.translateWordList.find(a => a.name === w.name)
|
||||
if (res) w = Object.assign(w, res)
|
||||
}
|
||||
})
|
||||
}
|
||||
wordData.words = cloneDeep(store.chapter)
|
||||
wordData.index = 0
|
||||
// console.log('wordData', wordData)
|
||||
}
|
||||
|
||||
onMounted(getCurrentPractice)
|
||||
|
||||
defineExpose({getCurrentPractice})
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user