VUE_vue二级路由配置

淩亂°似流年 2022-10-07 09:48 290阅读 0赞
  • 二级路由配置path时前面不能有 “ / “
  • 在一级路径信息数组中添加一个children配置项:

    { path:’/hot’,component:()=>import(‘@/views/Hot/index’),

    1. children:[
    2. { path:'/',redirect:'film'}, //配置默认显示模板内容
    3. { path:'film',component:{ template:'<p>妖猫传</p>'}},
    4. { path:'tv',component:{ template:'<p>河神</p>'}},
    5. { path:'music',component:{ template:'<p>缘分一道桥</p>'}}
    6. ]

    }

  • 在一级路由的模板中添加,to中的地址需要 加上一级路由

  • 供二级路由对应模板显示的也不能忘!

发表评论

表情:
评论列表 (有 0 条评论,290人围观)

还没有评论,来说两句吧...

相关阅读