Vue路由:标签应该放在哪里


刚开始学习Vue路由时,老是不知道<router-view />标签放哪里,很难受,慢慢使用很久后,才弄明白,记住一句话:将此钉子(<router-view />)埋于他路径的上一级模板内即可

如:

{
  path: "/one",
  name: "one",
  component: one,
  children: [
    {
      path: "two",
      component: two,
      children:[
        {
          path:"three",
          component:three
        }
      ]
    }
  ]
}

上述例子中

第一级路由(/one),需要将<router-view />标签放在app.vue

第二级路由(/one/two),需要将<router-view />标签放在one.vue

第三级路由(/one/two/three),需要将<router-view />标签放在two.vue


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 vue 路由嵌套 及 router-view vue-router --》children vue 路由视图,router-view嵌套跳转 【Vue】router-link 与 router-view