在我的部分,我有以下VUE路由器路由一個與'/event/:id'
VueJS路由導航不工作的動態路由組件時
routes: [
{
path: '/',
name: 'Dashboard',
component: Dashboard
},
{
path: '/events',
name: 'Events',
component: Events,
beforeEnter: requireAuth
},
{
path: '/event/:id',
name: 'Event details',
component: EventDetails,
alias: 'test'
}
]
動態事件當我訪問的事件ID的URL像這樣的:http://localhost:8080/event/59f4906d8835582773ef769a
一切都很好,並加載事件詳細信息頁面。但是,如果我嘗試從該組件導航到例如/ events頁面,則事件組件不會加載,並且我保持在同一頁面上。
我用它來導航離開該頁面中的鏈接的格式與<router-link>
這樣的:
<router-link to="events">Events</router-link>
什麼是URL看起來像你嘗試導航後? –