用于多种布局的流星路由器为家庭使用不同的布局

时间:2015-10-27 13:41:45

标签: javascript meteor url-routing iron-router

如何继承铁:路由器只在"主页" ...每当访问者访问网站时...我喜欢不同的外观而不使用导航栏。所有其他页面我想要导航吧。但是只有家里,我不知道。那你怎么继承铁的使用:路由器只有1页? 我们可以这样做吗?



Router.configure({
	layoutTemplate: 'main'
});
Router.route('/',  {
template: 'TEMPLATENAME',
layoutTemplate: 'home'
});




1 个答案:

答案 0 :(得分:2)

来自Meteor Routing and Layout

Router.configure({
  // the default layout
  layoutTemplate: 'mainNav'
});

Router.route('/', function () {
  this.render('firstPage');
  this.layout('mainNav');
});    

Router.route('/second', function () {
  this.render('secondPage');
  this.layout('mainNav');
});

您应该能够设置多个布局,并且只需指定页面以及所需的相应布局。

编辑:我的第一反应是关闭,抱歉。