鍍金池/ 問答/C++  HTML/ vue中 控制子組件中的某個(gè)子組件默認(rèn)顯示的方法?

vue中 控制子組件中的某個(gè)子組件默認(rèn)顯示的方法?

clipboard.png
router.js

 {
      path:'/index',
      name:'index',
      component:index,
      children:[
        {
          path:'/device/user',
          name:'user',
          component:user,
            children:[
             {
              path: '/device/deviceDisplay',
              name: 'deviceDisplay',
              component: deviceDisplay
             }
           ]
        }

非得我點(diǎn)了圖中子組件后,孫子組件才會(huì)出來,怎么樣設(shè)置成點(diǎn)擊父組件時(shí)出現(xiàn)上面圖樣式呢?

回答
編輯回答
孤島

      path:'/index',
      name:'index',
      component:index,
      redirect:'/device/deviceDisplay',
      children:[
        {
          path:'/device/user',
          name:'user',
          component:user,
            children:[
             {
              path: '/device/deviceDisplay',
              name: 'deviceDisplay',
              component: deviceDisplay
             }
           ]
        }

我理解的是默認(rèn)選中第一個(gè),用重定向

clipboard.png

https://router.vuejs.org/zh/g...

2018年2月25日 13:23