Commit 90b3fab28ef53135f3cab1f69a4675f98a130857
1 parent
cdf2c59e
feat: routes with parameters can be cached
Showing
4 changed files
with
14 additions
and
8 deletions
CHANGELOG.zh_CN.md
src/layouts/default/LayoutContent.tsx
1 | 1 | import { defineComponent } from 'vue'; |
2 | -// import { Layout } from 'ant-design-vue'; | |
2 | +import { Layout } from 'ant-design-vue'; | |
3 | +import { RouterView } from 'vue-router'; | |
4 | + | |
3 | 5 | // hooks |
4 | 6 | |
5 | 7 | import { ContentEnum } from '/@/enums/appEnum'; |
6 | 8 | import { appStore } from '/@/store/modules/app'; |
7 | -import PageLayout from '/@/layouts/page/index'; | |
9 | +// import PageLayout from '/@/layouts/page/index'; | |
8 | 10 | export default defineComponent({ |
9 | 11 | name: 'DefaultLayoutContent', |
10 | 12 | setup() { |
... | ... | @@ -13,9 +15,10 @@ export default defineComponent({ |
13 | 15 | const { contentMode } = getProjectConfig; |
14 | 16 | const wrapClass = contentMode === ContentEnum.FULL ? 'full' : 'fixed'; |
15 | 17 | return ( |
16 | - // <Layout.Content class={`layout-content ${wrapClass} `}> | |
17 | - <PageLayout class={`layout-content ${wrapClass} `} /> | |
18 | - // </Layout.Content> | |
18 | + <Layout.Content class={`layout-content ${wrapClass} `}> | |
19 | + {() => <RouterView />} | |
20 | + {/* <PageLayout class={`layout-content ${wrapClass} `} /> */} | |
21 | + </Layout.Content> | |
19 | 22 | ); |
20 | 23 | }; |
21 | 24 | }, | ... | ... |
src/layouts/page/index.tsx
... | ... | @@ -44,10 +44,10 @@ export default defineComponent({ |
44 | 44 | // TODO add key? |
45 | 45 | const Content = openCache ? ( |
46 | 46 | <KeepAlive max={max} include={cacheTabs}> |
47 | - <Component /> | |
47 | + <Component key={route.path} /> | |
48 | 48 | </KeepAlive> |
49 | 49 | ) : ( |
50 | - <Component /> | |
50 | + <Component key={route.path} /> | |
51 | 51 | ); |
52 | 52 | return openRouterTransition ? ( |
53 | 53 | <Transition | ... | ... |