1
我有在Vue.js 2Vue.js嵌套默认路由的孩子
默认chilrend路线的问题。当我最初访问本地主机/列表,它可以正确地装入index.vue和map.vue作为儿童。
当我使用router-link导航到localhost/listings/1,然后使用router-link回到localhost /列表时,它仍然加载show.vue模板。 这不应该发生?
我没有导航警卫或任何应该干扰。无论如何要纠正这一点?
我的路线:
window.router = new VueRouter({
routes: [
...
{
path: '/listings',
name: 'listing.index',
component: require('./components/listing/index.vue'),
children: [
{
path: '',
component: require('./components/listing/map.vue')
},
{
path: ':id',
name: 'listing.show',
component: require('./components/listing/show.vue')
}
]
},
...
]
});