[英]Meteor iron:router transitions
我正在尝试使用iron:router在页面之间实现过渡。 我在CSS中定义了动画,现在我需要做的就是用iron:router来调用它们。 由于某种原因,以下代码:
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);
返回一个异常:
路由分配从未呈现。 您是否忘了在onBeforeAction中调用this.next()?
正如Iron-Router文档中指定的那样,现在onBeforeAction
和onAfterAction
回调都需要this.next()
。 https://github.com/iron-meteor/iron-router
因此,只需将该行添加到fadeContentIn
和animateContentOut
代码的末尾fadeContentIn
。
如果您已登录,请尝试这样
Router.onBeforeAction(function () {
if (!Meteor.user()) {
this.render('Login');
} else {
this.next();
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.