2015-09-27 145 views
0

我期望,在主頁上在控制檯中沒有輸出。相反,我收到了「做某事」的信息。但除了'家'之外。除了鐵路路由器不工作

Router.configure({ 
    layoutTemplate: 'layout', 
    loadingTemplate: 'loading', 
    notFoundTemplate: 'notFound', 
}); 
Router.onBeforeAction(function() { 
    console.log('do something'); 
}, { except: ['home'] }); 

Router.route('/', function() { 
    name: 'home', 
    this.render('content', { to: 'content' }), 
    this.render('navigation', { to: 'navigation' }) 
}); 
+0

'/'路線裏'name''home''究竟是什麼?你似乎將選擇與行動混合在一起......這是行不通的,可以嗎? –

+0

你是對的,甚至沒有注意到缺少'action:';) –

回答

1

您似乎將選項與代碼混合在'/'路線中。這是行不通的。嘗試其中一種方法,例如,使用所有選項:

Router.route('/', { 
    name: 'home', 
    action: function() { 
     this.render('content', { to: 'content' }); 
     this.render('navigation', { to: 'navigation' }); 
    } 
});