Commit aafbb05236919bb0a9b5ba130d969a9ff921af37

Authored by vben
1 parent 5eecec03

chore: fix types

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
... ... @@ -4,7 +4,7 @@ import {
4 4 updateGrayMode,
5 5 updateHeaderBgColor,
6 6 updateSidebarBgColor,
7   -} from '/@/setup/theme';
  7 +} from '/@/logics/theme';
8 8 import { appStore } from '/@/store/modules/app';
9 9 import { ProjectConfig } from '/@/types/config';
10 10  
... ...
src/logics/mitt/tabChange.ts
... ... @@ -23,7 +23,5 @@ export function listenerLastChangeTab(
23 23 immediate = true
24 24 ) {
25 25 mitt.on(key, callback);
26   - if (immediate) {
27   - callback(lastChangeTab);
28   - }
  26 + immediate && callback(lastChangeTab);
29 27 }
... ...
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
... ... @@ -14,7 +14,8 @@ export interface RouteMeta {
14 14 affix?: boolean;
15 15 // icon on tab
16 16 icon?: string;
17   - // Jump address
  17 +
  18 + frameSrc?: string;
18 19  
19 20 // current page transition
20 21 transitionName?: string;
... ...
src/setup/App.ts
... ... @@ -17,7 +17,7 @@ import {
17 17 updateColorWeak,
18 18 updateHeaderBgColor,
19 19 updateSidebarBgColor,
20   -} from '/@/setup/theme';
  20 +} from '/@/logics/theme';
21 21  
22 22 import { appStore } from '/@/store/modules/app';
23 23 import { deepMerge } from '/@/utils';
... ...