Vue.js 2 のデフォルトの子ルートに問題があります。
最初に localhost/listings にアクセスすると、index.vue と map.vue が子として正しく読み込まれます。
router-link を使用して localhost/listings/1 に移動し、次に router-link を使用して localhost/listings に戻ると、引き続き 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')
}
]
},
...
]
});