Meteor IronRouter中的yieldTemplates和渲染到之间的差异

Meteor IronRouter中的yieldTemplates和渲染到之间的差异,meteor,iron-router,Meteor,Iron Router,在模板中使用收益率的这两种方法之间有什么区别?对我来说,两者都在做同样的事情: Router.route('/', { name: 'home', action: function() { this.render('content', { to: 'content' }); this.render('navigation', { to: 'navigation' }); } }); Router.route('/', { name

在模板中使用收益率的这两种方法之间有什么区别?对我来说,两者都在做同样的事情:

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

Router.route('/', {
    name: 'home',
    yieldTemplates: {
        'navigation':   { to: 'navigation' },
        'content':      { to: 'content' } 
    }
});

两者都在做同样的事情,这是一个你喜欢哪种风格的问题

但是,yieldTemplates已被弃用。它仍然有效,但如果要使用此样式,则应将yieldTemplates替换为yieldRegions


您可以看到

中记录的yieldRegions都在做同样的事情,您更喜欢哪种风格是一个偏好问题

但是,yieldTemplates已被弃用。它仍然有效,但如果要使用此样式,则应将yieldTemplates替换为yieldRegions

您可以看到中记录的yieldRegions

/**
 * The regionTemplates for the RouteController.
 */
RouteController.prototype.lookupRegionTemplates = function () {
  return this.lookupOption('yieldRegions') ||
    // XXX: deprecated
    this.lookupOption('regionTemplates') ||
    this.lookupOption('yieldTemplates') || {};
};