Files
vue-vben-admin/src/hooks/setting/useTransitionSetting.ts

32 lines
885 B
TypeScript
Raw Normal View History

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
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,
};
}