VUE_vue二级路由配置
- 二级路由配置path时前面不能有 “ / “
在一级路径信息数组中添加一个children配置项:
{ path:’/hot’,component:()=>import(‘@/views/Hot/index’),
children:[
{ path:'/',redirect:'film'}, //配置默认显示模板内容
{ path:'film',component:{ template:'<p>妖猫传</p>'}},
{ path:'tv',component:{ template:'<p>河神</p>'}},
{ path:'music',component:{ template:'<p>缘分一道桥</p>'}}
]
}
在一级路由的模板中添加,to中的地址需要 加上一级路由
供二级路由对应模板显示的也不能忘!
Hot
film
tv
music
还没有评论,来说两句吧...