Ben Lin
2024-06-18 ebbd788fbb2c0b45d4473798efc57eec8ba74a25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import type { TransitionSetting } from '#/config';
 
import { computed } from 'vue';
 
import { useAppStore } from '@/store/modules/app';
 
export function useTransitionSetting() {
  const appStore = useAppStore();
 
  const getEnableTransition = computed(() => appStore.getTransitionSetting?.enable);
 
  const getOpenNProgress = computed(() => appStore.getTransitionSetting?.openNProgress);
 
  const getOpenPageLoading = computed((): boolean => {
    return !!appStore.getTransitionSetting?.openPageLoading;
  });
 
  const getBasicTransition = computed(() => appStore.getTransitionSetting?.basicTransition);
 
  function setTransitionSetting(transitionSetting: Partial<TransitionSetting>) {
    appStore.setProjectConfig({ transitionSetting });
  }
  return {
    setTransitionSetting,
 
    getEnableTransition,
    getOpenNProgress,
    getOpenPageLoading,
    getBasicTransition,
  };
}