War*_*arz 2 meteor iron-router
如何使用meteor和Iron-Router从Template.event调用中将官方重定向到另一个路由.我似乎,至少与Dev分支遇到同样的错误
`if (this._isRunning) // 174
throw new Error('Already in a page run'); `
Run Code Online (Sandbox Code Playgroud)
作为一个例子,我有一个按钮,Router.go('/home');如果我运行这个点击调用,我得到'已经在页面运行'错误.其他任何使用路由器路由的方法?
它实际上'this.redirect('/anotherpath')'是导致问题的原因.有没有办法停止当前运行的页面运行并重定向到另一个路由?
cma*_*her 12
看起来你正在开发分支.您正在使用的代码已回滚,因为它无法正常工作.如果您仍有问题,请告诉我,对不起!
下面的代码将阻止当前路由控制器运行(停止任何下游挂钩和操作方法)并调用Router.go('/ anotherpath'),这将导致新路由运行.
this.redirect('/anotherpath')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8988 次 |
| 最近记录: |