Skip to content

Commit

Permalink
fix(projects): fix disabled page animate
Browse files Browse the repository at this point in the history
  • Loading branch information
honghuangdc committed Apr 15, 2024
1 parent 42e16a0 commit 23f283a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion src/layouts/modules/global-content/index.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { computed } from 'vue';
import { useAppStore } from '@/store/modules/app';
import { useThemeStore } from '@/store/modules/theme';
import { useRouteStore } from '@/store/modules/route';
Expand All @@ -19,12 +20,14 @@ withDefaults(defineProps<Props>(), {
const appStore = useAppStore();
const themeStore = useThemeStore();
const routeStore = useRouteStore();
const transitionName = computed(() => (themeStore.page.animate ? themeStore.page.animateMode : ''));
</script>

<template>
<RouterView v-slot="{ Component, route }">
<Transition
:name="themeStore.page.animateMode"
:name="transitionName"
mode="out-in"
@before-leave="appStore.setContentXScrollable(true)"
@after-enter="appStore.setContentXScrollable(false)"
Expand Down
10 changes: 5 additions & 5 deletions src/store/modules/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export const useAppStore = defineStore(SetupStoreId.App, () => {
async function reloadPage(duration = 300) {
setReloadFlag(false);

if (duration > 0) {
await new Promise(resolve => {
setTimeout(resolve, duration);
});
}
const d = themeStore.page.animate ? duration : 40;

await new Promise(resolve => {
setTimeout(resolve, d);
});

setReloadFlag(true);
}
Expand Down

0 comments on commit 23f283a

Please sign in to comment.