const router = new VueRouter({
routes: [
//
{
path: "/",
component: Login,
},
//
{
path: "/Base",
component: Base,
children:[
//
{
path: "",
component: Home,
},
//
{
path: "Devices",
component: Devices,
children:[
//
{
name: "Maps",
path: "Maps",
component: Maps,
},
//
{
name: "Lists",
path: "",
component: Lists,
},
//
{
name: "CurrentDevice",
path: "CurrentDevice",
component: Maps,
children:[
//
{
path: "Realtime",
component: Realtime,
},
]
}
]
},
]
},
//
{
path: "/Test",
component: Test,
},
//
{
path: "*",
redirect: "/"
}
]
});
with reference to the above code, I perform the following steps,
1. After running the project successfully, automatically navigate to"/", then enter the user name and password, and the page will navigate to"/ Base";
2. Navigate the route to"/ Base/Devices/Maps", and then navigate the route to"/ Test";
3. At this point I navigate the page to"/ Base", "and I want the situation to automatically navigate to the last browsed child route" / Base/Devices/Maps".
now, in order to achieve this effect, we have made a big bend, which is regarded as realized, but I think this method is not ideal. Can vue-router have the original api to achieve this effect?