11<script setup lang="ts">
22import { addStat , setUserDictProp } from ' @typewords/core/apis'
3- import { BaseIcon , Tooltip , Toast } from ' @typewords/base'
3+ import { BaseIcon , Toast , Tooltip } from ' @typewords/base'
44import ConflictNotice from ' @typewords/core/components/dialog/ConflictNotice.vue'
55import ArticleList from ' @typewords/core/components/list/ArticleList.vue'
66import Panel from ' @typewords/core/components/Panel.vue'
@@ -9,11 +9,8 @@ import SettingDialog from '@typewords/core/components/setting/SettingDialog.vue'
99import { AppEnv , DICT_LIST } from ' @typewords/core/config/env.ts'
1010import { genArticleSectionData , usePlayArticleTextAudio , usePlaySentenceAudio } from ' @typewords/core/hooks/article.ts'
1111import { useArticleOptions } from ' @typewords/core/hooks/dict.ts'
12- import {
13- useDisableEventListener ,
14- useOnKeyboardEventListener ,
15- useStartKeyboardEventListener ,
16- } from ' @typewords/core/hooks/event.ts'
12+ import { useOnKeyboardEventListener , useStartKeyboardEventListener } from ' @typewords/core/hooks/event.ts'
13+ import { useDisableEventListener } from ' @typewords/utils'
1714import useTheme from ' @typewords/core/hooks/theme.ts'
1815import ArticleAudio from ' @typewords/core/components/article/ArticleAudio.vue'
1916import EditSingleArticleModal from ' @typewords/core/components/article/EditSingleArticleModal.vue'
@@ -35,7 +32,7 @@ import {
3532} from ' @typewords/core/utils'
3633import { getPracticeArticleCacheLocal } from ' @typewords/core/utils/cache.ts'
3734import { usePracticeArticlePersistence } from ' @typewords/core/composables/usePracticePersistence'
38- import { useEvents , emitter , EventKey } from ' @typewords/core/utils/eventBus'
35+ import { emitter , EventKey , useEvents } from ' @typewords/core/utils/eventBus'
3936import { computed , onMounted , onUnmounted , provide , watch } from ' vue'
4037import { useRoute , useRouter } from ' vue-router'
4138import { DictType , PracticeArticleWordType , ShortcutKey } from ' @typewords/core/types/enum.ts'
@@ -205,9 +202,7 @@ onMounted(() => {
205202
206203async function unmount() {
207204 document .removeEventListener (' visibilitychange' , onvisibilitychange )
208-
209205 console .log (' onUnmounted' )
210- window .disableEventListener = false
211206 const cache = await getPracticeArticleCacheLocal ()
212207 // 如果有缓存,则更新花费的时间;因为用户不输入不会保存数据
213208 if (cache ) {
@@ -222,8 +217,6 @@ async function unmount() {
222217
223218onUnmounted (unmount )
224219
225- onDeactivated (unmount )
226-
227220useStartKeyboardEventListener ()
228221useDisableEventListener (() => loading )
229222
0 commit comments