[英]Meteor iron:router transitions
I am trying to implement transitions between pages by using iron:router. 我正在尝试使用iron:router在页面之间实现过渡。 I defined the animations in the css and now everything I need is to call them with the iron:router. 我在CSS中定义了动画,现在我需要做的就是用iron:router来调用它们。 For some reason the following code: 由于某种原因,以下代码:
animateContentOut = function() {
$('#content').removeClass("animated fadeIn");
return $('footer').addClass("hide");
}
fadeContentIn = function() {
$('#content').addClass("animated fadeIn");
return $('footer').removeClass("hide");
}
Router.onBeforeAction(animateContentOut);
Router.onAfterAction(fadeContentIn);
returns an exception: 返回一个异常:
Route dispatch never rendered. 路由分配从未呈现。 Did you forget to call this.next() in an onBeforeAction? 您是否忘了在onBeforeAction中调用this.next()?
As specified in the Iron-Router documentation, now both onBeforeAction
and onAfterAction
callbacks require this.next()
. 正如Iron-Router文档中指定的那样,现在onBeforeAction
和onAfterAction
回调都需要this.next()
。 https://github.com/iron-meteor/iron-router https://github.com/iron-meteor/iron-router
So simply simply add that line to the end of your fadeContentIn
and animateContentOut
code. 因此,只需将该行添加到fadeContentIn
和animateContentOut
代码的末尾fadeContentIn
。
If you have login try like this 如果您已登录,请尝试这样
Router.onBeforeAction(function () {
if (!Meteor.user()) {
this.render('Login');
} else {
this.next();
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.