Meteor 车把与';产生误差:用户名';param
我设置了我的路由器,这样如果有人键入sitename.com/:username,它就会直接进入该用户页面。但由于某些原因,当我尝试这样做时,有时会被重定向到我的主页,并在控制台中出现此错误Meteor 车把与';产生误差:用户名';param,meteor,handlebars.js,iron-router,Meteor,Handlebars.js,Iron Router,我设置了我的路由器,这样如果有人键入sitename.com/:username,它就会直接进入该用户页面。但由于某些原因,当我尝试这样做时,有时会被重定向到我的主页,并在控制台中出现此错误 Sorry, couldn't find the main yield. Did you define it in one of the rendered templates like this: {{yield}}? 这甚至更奇怪,因为我会说60%的时间它加载良好,没有问题。熟悉Meteor、Handl
Sorry, couldn't find the main yield. Did you define it in one of the rendered templates like this: {{yield}}?
这甚至更奇怪,因为我会说60%的时间它加载良好,没有问题。熟悉Meteor、Handlebar和Iron Router软件包的人是否知道这一点,或者可以提供帮助
如果你需要更多的代码,请告诉我
这是路线图。我在末尾添加了wait()调用,看看这是否有帮助。这似乎有点帮助,但错误仍然存在
this.route('userPosts', {
path: '/:username',
layoutTemplate: 'insideLayout',
template: 'userPosts',
yieldTemplates: {
'insideNavigationList': {to: 'list'},
'brandContainer': {to: 'brand'},
'postsPageOptions': {to: 'pageOptions'}
},
waitOn: function () {
return [Meteor.subscribe('userData'), Meteor.subscribe('selectedUser', this.params.username), Meteor.subscribe('posts', this.params.username)];
},
data: function () {
return Meteor.users.findOne({username: this.params.username}) && Session.set('selectedUserId', Meteor.users.findOne({username: this.params.username})._id)
},
before: function () {
if (!Meteor.user()) {
this.redirect('/login')
}
this.subscribe('selectedUser', this.params.username).wait();
this.ready();
}
});
你的动态路线是什么样子的,请上传代码用户名是否与可能已经准备好或尚未准备好的订阅有关?