鍍金池/ 問答/HTML/ 請教!??! vue組件切換和路由跳轉(zhuǎn)或嵌套路由哪個好?速度一樣嗎?

請教?。?! vue組件切換和路由跳轉(zhuǎn)或嵌套路由哪個好?速度一樣嗎?

vue組件切換和路由跳轉(zhuǎn)哪個好?性能速度一樣嗎,各自的區(qū)別是什么呀?
假如有兩個tab,使用組件可以用<component v-bind:is="currentTabComponent"></component>
路由使用
routes: [

    {         
      path: 'page1',
      component: page1
    },
    {
      path: 'page2',
      component: page2
    }    

]
嵌套路由使用
routes: [

{ path: '/page/:id', component: page,
  children: [
    {         
      path: 'page1',
      component: page1
    },
    {
      path: 'page2',
      component: page2
    }
  ]
}

]

回答
編輯回答
綰青絲

page1 和 page2 要是有一塊是公用的,就用 children。然后把公用的放到 page 里面。區(qū)別就是路徑不同,嵌套的路徑多包了一層。

2018年4月10日 11:13