简体   繁体   English

使用Flow Router,Meteor和React导航

[英]Navigation with Flow Router, Meteor and React

I am having problem redirecting my clients to some address. 我在将客户重定向到某个地址时遇到问题。

For example, the client go to this url, " http://localhost:3000/home ". 例如,客户端转到该URL“ http:// localhost:3000 / home ”。 If the client go to " http://localhost:3000/msg " using this code, 如果客户端使用此代码转到“ http:// localhost:3000 / msg ”,

<a href="msg" >Link</a>

It is working. 这是工作。 But when the client from " http://localhost:3000/people/231233213123 " and the client click the link with this code, 但是,当来自“ http:// localhost:3000 / people / 231233213123 ”的客户端和客户端单击具有此代码的链接时,

<a href="msg">Link</a>

It will go to " http://localhost:3000/people/231233213123/msg ". 它将转到“ http:// localhost:3000 / people / 231233213123 / msg ”。

I need to make the client go to " http://localhost:3000/msg ". 我需要使客户端转到“ http:// localhost:3000 / msg ”。

I tried usin this code, 我在这段代码中尝试过

<a href="../../msg">Link</a>

But it will redirect to " http://localhost:3000/people/msg ". 但是它将重定向到“ http:// localhost:3000 / people / msg ”。

I am using Flow router in React and Meteor. 我在React和Meteor中使用Flow路由器。

您需要在网址前加一个斜杠:

<a href="/msg">Link</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM