子路由

作者: 温梦丽 | 来源:发表于2020-01-09 18:01 被阅读0次

    app.vue

    <div id="app">
        <p>
          导航:
          <router-link to="/">首页</router-link>
          <router-link to="/banana/b1">香蕉1号</router-link>
          <router-link to="/banana/b2">香蕉2号</router-link>
        </p>
        <router-view/>
      </div>
    

    路由配置

     routes: [
        {
          path: '/',
          name:Login,
          component: Login
        },
        {
          path:'/banana',
          component: Banana,
          children:[
            {
              path:'/',
              component:B
            },
            {
              path:'b1',
              component:B1
            },
            {
              path:'b2',
              component:B2
            }
          ]
        }
    
      ]
    

    3.banana

    <div class="banana">
          <h1>{{message}}</h1>
            <router-view> </router-view>
        </div>
    
    

    相关文章

      网友评论

          本文标题:子路由

          本文链接:https://www.haomeiwen.com/subject/ljzyactx.html