在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML/ 關(guān)于vue-router嵌套路由問(wèn)題

關(guān)于vue-router嵌套路由問(wèn)題

跳轉(zhuǎn)不限子路由的內(nèi)容

routes: [
    {
      path: '/layout',
      alias: '/',
      name: 'index',
      component: components.HomePage,
      meta: {
        title: '首頁(yè)',
        icon: 'ddd'
      }
    },
    {
      path: '/user/:id',
      name: 'user',
      component: components.aaa,
      meta: {title: '用戶管理', icon: 'chart'},
      children: [
        {
          path: 'message',
          name: 'message',
          component: components.Message,
          meta: {title: '用戶信息'}
        },
        {
          path: 'authentication',
          name: 'authentication',
          component: components.Authentication,
          meta: {title: '用戶認(rèn)證管理'}
        },
      ]
    },
  ]

我已經(jīng)在這個(gè)組件中使用router-view了

<template>
  <div>
    fdfdsfds
    <router-view/>
  </div>
</template>

跳轉(zhuǎn)方式

  this.$router.push({
          name: path[0],
          params: {id: path[1]}
        })
       

但是地址欄的顯示是對(duì)的
圖片描述

這是我補(bǔ)充的內(nèi)容

 {
      path: '/user',
      name: 'user',
      component: components.aaa,
      meta: {title: '用戶管理', icon: 'chart'},
      children: [
        {
          path: '/user/message',
          name: 'message',
          component: components.Message,
          meta: {title: '用戶信息'}
        },
        {
          path: '/user/authentication',
          name: 'authentication',
          component: components.Authentication,
          meta: {title: '用戶認(rèn)證管理'}
        },
      ]
    },
我要是這么寫(xiě)的話好用
回答
編輯回答
檸檬藍(lán)

你是要跳轉(zhuǎn) /user/id/message
還是要跳 /user/message ?
你這樣寫(xiě),跳的應(yīng)該是 /user/id/message
要跳/user/message 的話就不要那個(gè)id了

2017年1月29日 13:45
編輯回答
嫑吢丕
path: '/user/:id'  //id呢?
2017年4月12日 05:43