Skip to content

Commit

Permalink
fix: 修复多级菜单无法正常加载bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yuntian001 committed Sep 2, 2022
1 parent 8d64714 commit f14edad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/meComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useLoadMessages } from '@/locales/i18n';
import { done } from '@/utils/nProgress';
import { localeConfig } from '@/config';
export default defineComponent({
name: 'meComponent',
props: {
is: {
type: [String, Object],
Expand Down Expand Up @@ -44,6 +45,7 @@ export default defineComponent({
);
if (props.keepAlive) {
const index = components.length - 1;
console.log(index);
components.push(h(MeKeepAlive, props.keepAlive, [components[index]]));
}
if (props.transition) {
Expand Down
6 changes: 5 additions & 1 deletion src/layout/components/page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<router-view v-slot="{ Component, route }">
<me-component
:is="Component"
:transition="{ name: 'fade-transform', mode: 'out-in' }"
:transition="props.transition"
:keep-alive="keepAliveProps"
:component-key="route.fullPath"
done-progress
Expand All @@ -14,6 +14,10 @@
<script setup lang="ts" name="layoutPage">
import { MeKeepAliveProps } from '@/components/meKeepAlive';
import { useRouteStore } from '@/store';
import { PropType, TransitionProps } from 'vue';
const props = defineProps({
transition: Object as PropType<TransitionProps>,
});
const routeStore = useRouteStore();
const keepAliveProps = reactive<MeKeepAliveProps>({
max: 30,
Expand Down
2 changes: 1 addition & 1 deletion src/layout/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<el-scrollbar>
<layout-header v-if="!themeConfig.fixedHeader"></layout-header>
<div class="main">
<layout-page></layout-page>
<layout-page :transition="{ name: 'fade-transform', mode: 'out-in' }"></layout-page>
</div>
</el-scrollbar>
</el-main>
Expand Down

0 comments on commit f14edad

Please sign in to comment.