这是我的铁路由器路线
this.route("video",{
path:'/video/:_id/:slug',
waitOn: function() {
Session.set("currentTitle",this.params.slug);
Session.set("currentVideoId",this.params._id);
console.log("waitOn");
},
onBeforeAction: function () {
},
action:function(){
console.log("action");
this.render();
},
data:function(){
console.log("data");
var video= Videos.findOne({_id: this.params._id});
if(video){
console.log("set the url");
Session.set("currentVideoURL",video.videourl);
Session.set("thumb",video.thumbs);
}
return {
video:video
};
}
});
在模板渲染事件之后,我正在调用一些流星方法并处理结果
Template.video.rendered=function(){
console.log("render event");
var id=Session.get("currentVideoURL");
Meteor.call("getdata",id,function(e,d){
//processing
});
};
在我的HTML中,我正在显示一些相关视频,点击那些我想用这个视频数据打开同一页面的视频
但路由器中的视频数据正在重置并且渲染事件未触发(我没有在控制台中看到渲染事件),
我希望页面打开,因为我们来自另一个网址,我想要解雇所有事件。
如何实现这一目标?