Fixed a bug where the toggle dictionary could not load words
This commit is contained in:
@@ -27,7 +27,7 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
//虚拟列表长度限制
|
||||
const limit = 99
|
||||
const limit = 101
|
||||
const settingStore = useSettingStore()
|
||||
const listRef: any = $ref()
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -5,6 +5,7 @@ import {emitter, EventKey} from "@/utils/eventBus.ts"
|
||||
import {useRuntimeStore} from "@/stores/runtime.ts";
|
||||
import * as localforage from "localforage";
|
||||
import {nanoid} from "nanoid";
|
||||
import {state} from "vue-tsc/out/shared";
|
||||
|
||||
export interface BaseState {
|
||||
myDictList: Dict[],
|
||||
@@ -290,6 +291,7 @@ export const useBaseStore = defineStore('base', {
|
||||
this.myDictList.push(cloneDeep(dict))
|
||||
this.current.index = this.myDictList.length - 1
|
||||
}
|
||||
|
||||
emitter.emit(EventKey.resetWord)
|
||||
emitter.emit(EventKey.changeDict)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user