Blame view

src/layouts/page/useTransition.ts 547 Bytes
陈文彬 authored
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { onUnmounted } from 'vue';
import { appStore } from '/@/store/modules/app';
export function useTransition() {
  function handleAfterEnter() {
    const { openRouterTransition, openPageLoading } = appStore.getProjectConfig;
    if (!openRouterTransition || !openPageLoading) return;
    // 路由切换动画结束之后关闭loading
    appStore.setPageLoadingAction(false);
  }

  onUnmounted(() => {
    handleAfterEnter();
    stop();
  });
  return {
    handleAfterEnter,
    on: {
      onAfterEnter: handleAfterEnter,
    },
  };
}