Commit aafbb05236919bb0a9b5ba130d969a9ff921af37
1 parent
5eecec03
chore: fix types
Showing
7 changed files
with
23 additions
and
8 deletions
src/hooks/core/useEffect.ts
0 → 100644
1 | +import { WatchOptions } from 'vue'; | |
2 | +import { watch } from 'vue'; | |
3 | +import { isFunction } from '/@/utils/is'; | |
4 | + | |
5 | +export const useEffect = (effectHandler: Fn, dependencies: any[]) => { | |
6 | + return watch( | |
7 | + dependencies, | |
8 | + (changedDependencies, prevDependencies, onCleanUp) => { | |
9 | + const effectCleaner = effectHandler(changedDependencies, prevDependencies); | |
10 | + if (isFunction(effectCleaner)) { | |
11 | + onCleanUp(effectCleaner); | |
12 | + } | |
13 | + }, | |
14 | + { immediate: true, deep: true } as WatchOptions | |
15 | + ); | |
16 | +}; | ... | ... |
src/layouts/default/setting/components/SettingFooter.vue
... | ... | @@ -27,7 +27,7 @@ |
27 | 27 | import { useMessage } from '/@/hooks/web/useMessage'; |
28 | 28 | import { useCopyToClipboard } from '/@/hooks/web/useCopyToClipboard'; |
29 | 29 | import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
30 | - import { updateColorWeak, updateGrayMode } from '/@/setup/theme'; | |
30 | + import { updateColorWeak, updateGrayMode } from '/@/logics/theme'; | |
31 | 31 | |
32 | 32 | export default defineComponent({ |
33 | 33 | name: 'SettingFooter', | ... | ... |
src/layouts/default/setting/handler.ts
src/logics/mitt/tabChange.ts
src/setup/theme/index.ts renamed to src/logics/theme/index.ts
... | ... | @@ -24,7 +24,7 @@ function toggleClass(flag: boolean, clsName: string, target?: HTMLElement) { |
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Change the status of the project's color weakness mode |
27 | - * @param gray | |
27 | + * @param colorWeak | |
28 | 28 | */ |
29 | 29 | export const updateColorWeak = (colorWeak: boolean) => { |
30 | 30 | toggleClass(colorWeak, 'color-weak', document.documentElement); | ... | ... |
src/router/types.d.ts
src/setup/App.ts