在路由表配置了子路由,點(diǎn)擊可以發(fā)現(xiàn)地址欄產(chǎn)生了路由的跳轉(zhuǎn)风皿,但是頁面不刷新是怎么回事呢河爹?
經(jīng)過檢查后發(fā)現(xiàn)了
!M┛睢咸这!居然是沒在組件模板寫 <router-view></router-view>
來到尤大佬的官方文檔可進(jìn)行詳細(xì)了解
嵌套路由
https://router.vuejs.org/zh/guide/essentials/nested-routes.html
<div id="app">
<router-view></router-view>
</div>
const User = {
template: '<div>User {{ $route.params.id }}</div>'
}
const router = new VueRouter({
routes: [
{ path: '/user/:id', component: User }
]
})