【发布时间】:2017-11-19 15:00:46
【问题描述】:
我尝试使用 router.go、router.push、router.replace 和 window.location.href 转到“www.mytargeturl.org”来重定向我的 vuejs 应用程序,但我总是得到 myVueapp.com/www.mytargeturl。组织 这是我的路线:
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
]
【问题讨论】:
-
只需使用常规的
a标签。 vue-router 用于在您的应用内导航 -
这很简单:不要使用 vue-router,因为它会重定向到内部链接(即在应用程序内)。使用
window.location应该可以正常工作。 -
在发帖之前我已经尝试过 window.location 但没有成功。这是我的示例:jsfiddle.net/alvirtuoso/dkb1d13h
标签: vue.js vuejs2 vue-router