Skip to content

Commit d1178de

Browse files
committed
chore(play): 使用 exact 进行精准渲染子级路由
1 parent 521c13e commit d1178de

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

play/src/layout/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ watch(
4848
<BetterRouterView
4949
v-slot="{ Component: viewComponent }"
5050
:resolve-view-key
51+
exact
5152
>
5253
<KeepAlive :include="[...keepAliveValues]">
5354
<Component

play/src/router/index.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ const router = createRouter({
1717
meta: {
1818
keepAlive: true,
1919
},
20-
},
21-
{
22-
path: '/list/detail/:viewKey',
23-
component: ListDetail,
24-
meta: {
25-
keepAlive: true,
26-
},
20+
children: [
21+
{
22+
path: 'detail/:viewKey',
23+
component: ListDetail,
24+
meta: {
25+
keepAlive: true,
26+
},
27+
},
28+
],
2729
},
2830

2931
{
@@ -32,14 +34,16 @@ const router = createRouter({
3234
meta: {
3335
keepAlive: true,
3436
},
35-
},
36-
{
37-
path: '/list2/detail/:viewKey',
38-
component: ListDetail,
39-
meta: {
40-
keepAlive: true,
41-
singleton: true,
42-
},
37+
children: [
38+
{
39+
path: 'detail/:viewKey',
40+
component: ListDetail,
41+
meta: {
42+
keepAlive: true,
43+
singleton: true,
44+
},
45+
},
46+
],
4347
},
4448
],
4549
},

0 commit comments

Comments
 (0)