admin管理员组文章数量:1297037
I am migrating from Vue2 to Vue3. The router seems to work properly in the sense that I am being redirected to the correct components, but the url in the browser window does not update i.e. I am in component with path /home but the browser shows /, I am in the component with path /table and my browser still shows /.
My router file has:
const router = new createRouter({
history: createMemoryHistory(),
routes: [
{ path: '/home', name: 'home-page', component: HomePage, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/sensitivePart', name: 'sensitive-part-page', component: SensitivePart, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/rmer', name: 'rmer-page', component: RMER, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/rmerClosedOrder', name: 'rmer-closed-order-page', component: RmerClosedOrder, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/mers', name: 'mers-page', component: MERS, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/mersHistory', name: 'mers-history-page', component: MERSHistory, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/databaseProfileKeyword', name: 'database-profile-keyword-page', component: DatabaseProfileKeyword, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/catsSensitivePartTracking', name: 'sens-part-trac', component: SensitivePartTrackingPage, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/catsSensitivePartTrackingHistory', name: 'sens-part-trac-hist', component: SensitivePartTrackingHistoryPage, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/', name: 'login-page', component: LoginPage},
]
});
And in the the main.js
const app = createApp(App);
app.use(CarbonVue3);
app.use(router);
app.mount('#app');
The images show to different components: /sensitivePart and /rmer but the browser shows / on both. This happens to all paths.
/sensitivePart
/rmer
I am migrating from Vue2 to Vue3. The router seems to work properly in the sense that I am being redirected to the correct components, but the url in the browser window does not update i.e. I am in component with path /home but the browser shows /, I am in the component with path /table and my browser still shows /.
My router file has:
const router = new createRouter({
history: createMemoryHistory(),
routes: [
{ path: '/home', name: 'home-page', component: HomePage, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/sensitivePart', name: 'sensitive-part-page', component: SensitivePart, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/rmer', name: 'rmer-page', component: RMER, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/rmerClosedOrder', name: 'rmer-closed-order-page', component: RmerClosedOrder, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/mers', name: 'mers-page', component: MERS, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/mersHistory', name: 'mers-history-page', component: MERSHistory, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/databaseProfileKeyword', name: 'database-profile-keyword-page', component: DatabaseProfileKeyword, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/catsSensitivePartTracking', name: 'sens-part-trac', component: SensitivePartTrackingPage, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/catsSensitivePartTrackingHistory', name: 'sens-part-trac-hist', component: SensitivePartTrackingHistoryPage, beforeEnter: jwtMicroservices.validateJwtToken },
{ path: '/', name: 'login-page', component: LoginPage},
]
});
And in the the main.js
const app = createApp(App);
app.use(CarbonVue3);
app.use(router);
app.mount('#app');
The images show to different components: /sensitivePart and /rmer but the browser shows / on both. This happens to all paths.
/sensitivePart
/rmer
Share Improve this question asked Feb 11 at 16:14 KalioKalio 212 bronze badges1 Answer
Reset to default 1This was solved by changing the history param from the router to:
history: createWebHistory()
Couldn't find documentation on the difference for this, just started trying different stuff.
本文标签: vuejs3Vue 3 Router not displaying the path in the browserStack Overflow
版权声明:本文标题:vuejs3 - Vue 3 Router not displaying the path in the browser - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741649022a2390360.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论