routerLink附加我的链接 [英] routerLink appends my link

查看:75
本文介绍了routerLink附加我的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个出现在所有页面上的菜单导航组件:

I have a menu navigation component that appears on all pages:

我有一些这样的链接: - 下列的 -追随者

I have some links like this: - Following - Followers

当我在 http://localhost/#/上时,链接创建成功,例如:

When I'm on http://localhost/#/ the links are created ok eg :

- http://localhost/#/network;scrollTo=%23Following
- http://localhost/#/network;scrollTo=%23Followers

但是,如果我单击一个,则另一个显示如下:

But If I click on one the other shows something like this :

- http://localhost/#/network;scrollTo=%23Following/(network;scrollTo=%23Followers)

我该如何重置?

推荐答案

您使用的是相对网址,这就是routerLink不断附加网址的原因.您应该查看相对导航文档.

You are using relative urls, that's why routerLink keeps appending them. You should check the Relative Navigation documentation.

大括号中的斜杠或./表示当前URL的相对URL

No slash in the biggining or ./ means a relative url to the current one

以斜杠开头表示绝对网址

A starting slash means an absolute url

这篇关于routerLink附加我的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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