我尝试使用 router.go、router.push、router.replace 和 window.location.href 转到“www.mytargeturl.org”来重定向我的 vuejs 应用程序,但我总是得到 myVueapp.com/www.mytargeturl.org 这是我的路线:
routes:[
{path: '/', component: App,
children:[
{
path: 'detail',
component: ItemDetail,
props: true
},
{
path: 'search',
component: Middle
}
]
},
{
path: '/test', component: Test
},
{ path: '/a', redirect: 'www.mytargeturl.org' } // also tried this but didnt work
]
原文由 codely 发布,翻译遵循 CC BY-SA 4.0 许可协议
同意其他评论中的人。 Vue 的理念不是解决已经解决的问题。同样在这里。尽可能使用普通的
a
链接标签。如果您需要通过路由器,请使用 Navigation Guards :