[英]Vue-router update routes programmatically
Is there any way to update Vue-router
routes programmatically without reloading the page?有没有办法在不重新加载页面的情况下以编程方式更新
Vue-router
路由?
I'm loading different route paths based on the language that is selected, eg:我正在根据所选语言加载不同的路线路径,例如:
{ path: '/' + i18n.t('url_welcome'), name: 'welcome, component: Welcome },
Unfortunately, route paths don't update automatically when the language is changed.不幸的是,当语言改变时,路由路径不会自动更新。
Dynamic routing is achieved mainly via two functions: router.addRoute() and router.removeRoute().
动态路由主要通过两个函数实现:router.addRoute() 和 router.removeRoute()。
https://router.vuejs.org/guide/advanced/dynamic-routing.html#adding-routes https://router.vuejs.org/guide/advanced/dynamic-routing.html#adding-routes
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.