Meteor动态模板不工作

Meteor动态模板不工作,meteor,meteor-blaze,Meteor,Meteor Blaze,行{{>Template.dynamic Template=content}使我的页面无法加载。它实际上有时会使我的浏览器崩溃。我让它工作了一段时间,但发生了一些事情,现在它不再工作了。 {{>Template.dynamic Template='navBar'}}工作正常,因此我的包应该是正常的 流星:1.4 包装:卡迪拉:流动路由器,卡迪拉:火焰布局 导入/ui/layouts/mainLayout.html: <template name="mainLayout"> <

行{{>Template.dynamic Template=content}使我的页面无法加载。它实际上有时会使我的浏览器崩溃。我让它工作了一段时间,但发生了一些事情,现在它不再工作了。 {{>Template.dynamic Template='navBar'}}工作正常,因此我的包应该是正常的

流星:1.4 包装:卡迪拉:流动路由器,卡迪拉:火焰布局

导入/ui/layouts/mainLayout.html:

<template name="mainLayout">
  <header>
    <div class="container">
      {{> navBar }}
    </div>
  </header>
  <body>
    <div class="container">
      {{> Template.dynamic template=content }} <!-- not working -->
    </div>
  </body>
  <footer>
    <div class="container">
      <h3>Footer</h3>
    </div>
  </footer>
</template>
导入/startup/client/routes.js:

import { FlowRouter } from 'meteor/kadira:flow-router';
import { BlazeLayout } from 'meteor/kadira:blaze-layout';
import '../../ui/layouts/mainLayout.js';
import '../../ui/pages/settings.js';

FlowRouter.route('/', {
  action() {
    BlazeLayout.render('mainLayout', { content: 'mainLayout' });
  },
});

FlowRouter.route('/settings', {
  action() {
    BlazeLayout.render('mainLayout', { content: 'settings' });
  },
});
导入/ui/pages/settings.html:

<template name="settings">
  <div class="container">
    <h1>This is the settings page</h1>
  </div>
</template>

这是设置页面
此路线:

FlowRouter.route('/', {
  action() {
    BlazeLayout.render('mainLayout', { content: 'mainLayout' });
  },
});
因为您正在将
mainLayout
组件插入自身,所以无法工作-嵌套的
content
helper就是问题所在。相反,您应该将不同的组件呈现到
内容中

BlazeLayout.render('mainLayout', { content: 'home' }); // or whatever component should be at "/"

那么你是在布局中放置布局<代码>BlazeLayout.render('mainLayout',{content:'mainLayout'})我对文件进行了一些重命名,在此过程中我的大脑停止了工作。非常感谢。它起作用了。
BlazeLayout.render('mainLayout', { content: 'home' }); // or whatever component should be at "/"