2023-11-24 10:32:04 +08:00
|
|
|
import type { TransitionSetting } from '#/config';
|
2020-11-25 00:43:33 +08:00
|
|
|
|
2021-04-10 19:25:49 +08:00
|
|
|
import { computed } from 'vue';
|
2020-11-25 00:43:33 +08:00
|
|
|
|
2023-11-20 12:27:11 +08:00
|
|
|
import { useAppStore } from '@/store/modules/app';
|
2020-11-25 00:43:33 +08:00
|
|
|
|
2021-04-10 19:25:49 +08:00
|
|
|
export function useTransitionSetting() {
|
|
|
|
|
const appStore = useAppStore();
|
2020-11-25 00:43:33 +08:00
|
|
|
|
2021-04-10 19:25:49 +08:00
|
|
|
const getEnableTransition = computed(() => appStore.getTransitionSetting?.enable);
|
2020-11-25 00:43:33 +08:00
|
|
|
|
2021-04-10 19:25:49 +08:00
|
|
|
const getOpenNProgress = computed(() => appStore.getTransitionSetting?.openNProgress);
|
2020-11-25 00:43:33 +08:00
|
|
|
|
2021-04-10 19:25:49 +08:00
|
|
|
const getOpenPageLoading = computed((): boolean => {
|
|
|
|
|
return !!appStore.getTransitionSetting?.openPageLoading;
|
|
|
|
|
});
|
2020-11-25 00:43:33 +08:00
|
|
|
|
2021-04-10 19:25:49 +08:00
|
|
|
const getBasicTransition = computed(() => appStore.getTransitionSetting?.basicTransition);
|
2020-11-25 00:43:33 +08:00
|
|
|
|
2021-04-10 19:25:49 +08:00
|
|
|
function setTransitionSetting(transitionSetting: Partial<TransitionSetting>) {
|
|
|
|
|
appStore.setProjectConfig({ transitionSetting });
|
|
|
|
|
}
|
2020-11-25 00:43:33 +08:00
|
|
|
return {
|
|
|
|
|
setTransitionSetting,
|
|
|
|
|
|
|
|
|
|
getEnableTransition,
|
|
|
|
|
getOpenNProgress,
|
|
|
|
|
getOpenPageLoading,
|
|
|
|
|
getBasicTransition,
|
|
|
|
|
};
|
|
|
|
|
}
|