在Iron-Router中为相同的URL推送新状态 [英] Pushing new state for same URL in Iron-Router

查看:61
本文介绍了在Iron-Router中为相同的URL推送新状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用Meteor中的Iron-Router将新状态推送到浏览器的历史记录中,而无需使用新的URL吗?

Can I use Iron-Router in Meteor to push a new state onto the browser's history, without going to a new URL?

我想显示一个模式,但允许用户使用后退按钮再次隐藏它.

I would like to show a modal but enable to user to hide it again using the back button.

推荐答案

还没有尝试过,但是我认为是基于

Haven't tried this, but I think something based on

Router.go(Router.current().request.url + '/modal')`

可能会工作.您可以使用可选参数定义路径,如果该路径为'modal',则显示模态.如果您具有URL参数,则可能会导致问题,在这种情况下,您将不得不更加巧妙地使用URL.

might work. You define your route with an optional parameter, and if it's 'modal' then display the modal. That may lead to problems if you have URL parameters, in which case you'd have to get more clever with the URL.

这篇关于在Iron-Router中为相同的URL推送新状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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