实现某个场景:一开始显示子级路由页面。然后也能显示其它父级路由的。
下面的路由情况是这样的 HelloWorld 和Second是父级路由,Test是子路由
import HelloWorld from '@/components/HelloWorld'
import Test from '@/components/Test'
import Second from '@/components/Second'
export default new Router({
routes: [
{
path: '',
name: 'HelloWorld',
component: HelloWorld,
redirect: 'test',
children: [
{
path: 'test',
component: Test
}
]
},
{
path: '/second',
name: 'Second',
component: Second
}
]
})