简体   繁体   English

如何在Meteor Iron-Router中的一条路由中不显示默认模板?

[英]How to not display the default template in one of the routes in Meteor Iron-Router?

I'm trying to render my home template without the default layoutTemplate . 我正在尝试在没有默认layoutTemplate的情况下呈现我的home模板。 Iron-router Guide shows I need to use Router.onBeforeAction . Iron-router指南显示我需要使用Router.onBeforeAction I just can't figure out how exactly to implement it. 我只是不知道如何准确地实现它。

Router.configure({
 layoutTemplate: 'navbar'

}

Router.route('/', {name: 'home'});

You can override the default layout template by calling this.layout(); 您可以通过调用this.layout();覆盖默认布局模板this.layout(); in your route. 在你的路线上。 Either you supply a different layout template, eg this.layout('homeLayout'); 您可以提供其他布局模板,例如this.layout('homeLayout'); or you just leave the arguments empty. 或者您只将参数留空。

For example: 例如:

Router.route('/', function () {
    this.layout();
    this.render('home');
}, {name: 'home'});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM