我可以找到的所有示例都有助于管理应用程序内的路由,如下所示this.$router.push({name: RouteName})如果我想通过绝对路径进行重定向怎么办?我尝试this.$router.push({fullPath: https://google.com})但它什么都不做
1 回答
慕的地6264312
TA贡献1817条经验 获得超6个赞
浏览器专为在应用内进行路由而设计。使用它来重定向到外部站点是没有意义的。
您仍然可以像这样使用vue路由器:
this.$router.push({ redirect: window.location.href = 'https://google.com' });
但是最好使用香草js:
window.location.href = 'https://google.com';
添加回答
举报
0/150
提交
取消