0
我的應用程序在本地完全運行。但是,當我部署它時,我收到在收集帖子被假定被訪問的頁面上的JavaScript控制檯中收到以下錯誤。使用Iron Router訪問部署應用程序的集合時出現Meteor ReferenceError
Exception from Deps recompute: ReferenceError: Posts is not defined
at Object.route.data.posts
這裏是我使用的JavaScript文件,該文件傳遞到帖子部署時不會加載模板postsLists路由器。
Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading',
waitOn: function() { console.log('waiting'); return [Meteor.subscribe('posts'), Meteor.subscribe('files')]; }
});
Router.map(function(){
this.route('postPage', {
path:'/posts/:_id',
data: function() {return Posts.findOne(this.params._id); }
});
this.route('welcome', {path: '/'});
this.route('postsList', {path: '/List',
data: {
posts: function() {
return Posts.find({}, {sort: {submitted: -1}});
}
}});
this.route('postSubmit',{
path:'/submit'
});
this.route('yourPosts',{
path:'/yourposts'
});
this.route('officialPosts',{
path:'/featured'
});
this.route('postEdit', {
path: '/posts/:_id/edit',
data: function() { return Posts.findOne(this.params._id); }
});
});
var requireLogin = function(){
if(! Meteor.user()){
this.render('accessDenied');
this.stop();
}
};
Router.before(requireLogin, {only: ['postSubmit','postsList','yourPosts','officialPosts','postEdit']});
該網站也是在fed.meteor.com訪問。
在此先感謝。
是的!那正是我需要的。我不知道使用的bootstrap-3軟件包被放置在提供樣式的客戶端文件夾中,除了accounts-ui-bootstrap-3軟件包以外,這些軟件包使得所有功能都有錯誤。將它放在packages文件夾中修復了錯誤。 – user3286942