【问题标题】:Is there a way to prevent iron-router from trying to route a link?有没有办法防止 Iron-router 尝试路由链接?
【发布时间】:2014-10-05 23:52:23
【问题描述】:

我的 Meteor 应用程序在子文件夹中运行,而我的域的其余部分仍在 Wordpress 上运行。我需要流星应用程序中的特定链接才能转到 Wordpress 上的路径。

所以流星应用程序就在这里 https://domain.com/meteor

WordPress 在这里 https://domain.com

我的链接路径看起来像这样 https://domain.com/WPLink

如果我在 Meteor 应用程序中单击 https://domain.com/WPLink,Iron-router 会尝试将其发送到我的默认路由 /meteor,但这不是它应该去的地方。

知道如何确保 Iron-router 没有尝试路由该链接吗?

【问题讨论】:

  • meteor 的根 url 是 domain.com/meteor 所以我不认为你可以从meteor 访问 WP(但我可能错了)。我会创建一个带有 'a hreg="domain.com" ' 的模板 wp_link 并且只要 id 需要它,我只需渲染它 {{>wp_link}}

标签: meteor iron-router


【解决方案1】:

在旧版本的 iron-router 中,您会执行以下操作:

IronLocation.configure({
  'linkSelector' : 'a[href]:not([noroute])',
});

不过,我不能 100% 确定这是否适用于 1.0

【讨论】:

  • 客户端上的任何位置。
猜你喜欢
  • 1970-01-01
  • 2020-01-10
  • 2013-09-02
  • 1970-01-01
  • 2019-02-15
  • 2014-05-26
  • 1970-01-01
  • 1970-01-01
  • 2022-01-23
相关资源
最近更新 更多