VueJs Vue路由器链接外部网站 [英] VueJs vue-router linking an external website

查看:621
本文介绍了VueJs Vue路由器链接外部网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能很简单,但是我查看了文档,但找不到任何东西.我想将我的"github"链接重定向为github.com.但是,它只是将" https://github.com "附加到我的网址中,而不是跟随该链接.这是一个代码段:

This may be simple, but I've looked over documentation and can't find anything about it. I want to have my 'github' link redirect to say, github.com. However, its just appending 'https://github.com' to my url instead of following the link. Here is a snippet:

 <BreadcrumbItem to='https://github.com'>
    <Icon type="social-github"></Icon>
 </BreadcrumbItem>

(这是将iView用于自定义CSS,但"to"的工作方式与router-link相同).

(This is using iView for custom CSS, but 'to' works in the same way as router-link).

最终发生的事情是这样的:

What ends up happening is this:

推荐答案

我阅读了Daniel的链接并找到了解决方法:

I read Daniel's Link and found a workaround:

{
     path: '/github',
     beforeEnter() {location.href = 'http://github.com'}
}

这篇关于VueJs Vue路由器链接外部网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆