添加动态路由测试页

This commit is contained in:
chuzhixin 2020-10-06 00:01:14 +08:00
parent f7d960e8c3
commit f2dd815dc1
3 changed files with 33 additions and 0 deletions

View File

@ -87,7 +87,9 @@
watch: { watch: {
$route: { $route: {
handler({ fullPath }) { handler({ fullPath }) {
//
if (fullPath === "/index") fullPath = "/"; if (fullPath === "/index") fullPath = "/";
if (fullPath === "/test/test") fullPath = "/test";
this.selectedKeys = [fullPath]; this.selectedKeys = [fullPath];
}, },
immediate: true, immediate: true,

View File

@ -43,6 +43,26 @@ export const asyncRoutes = [
}, },
], ],
}, },
{
path: "/test",
component: Layout,
redirect: "/test/test",
meta: {
title: "动态路由测试",
icon: "test-tube-line",
},
children: [
{
path: "test",
name: "Test",
component: () => import("@/views/test"),
meta: {
title: "动态路由测试",
icon: "test-tube-line",
},
},
],
},
{ {
path: "/error", path: "/error",
name: "Error", name: "Error",

11
src/views/test/index.vue Normal file
View File

@ -0,0 +1,11 @@
<template>
<div class="test-container">
<a-alert message="动态路由测试"></a-alert>
</div>
</template>
<script>
export default {
name: "Test",
};
</script>