Vben
2021-02-26 fcee7d4eb71471dd40567c8d7c97302eeee80697
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
32
33
import type { TransitionSetting } from '/#/config';
 
import { computed, unref } from 'vue';
 
import { appStore } from '/@/store/modules/app';
 
const getTransitionSetting = computed(() => appStore.getProjectConfig.transitionSetting);
 
const getEnableTransition = computed(() => unref(getTransitionSetting)?.enable);
 
const getOpenNProgress = computed(() => unref(getTransitionSetting)?.openNProgress);
 
const getOpenPageLoading = computed((): boolean => {
  return !!unref(getTransitionSetting)?.openPageLoading;
});
 
const getBasicTransition = computed(() => unref(getTransitionSetting)?.basicTransition);
 
function setTransitionSetting(transitionSetting: Partial<TransitionSetting>) {
  appStore.commitProjectConfigState({ transitionSetting });
}
 
export function useTransitionSetting() {
  return {
    setTransitionSetting,
 
    getTransitionSetting,
    getEnableTransition,
    getOpenNProgress,
    getOpenPageLoading,
    getBasicTransition,
  };
}