第{{> Template.dynamic template=content }}行使我的页面无法加载。它有时真的会让我的浏览器崩溃。我让它工作了一段时间,但发生了一些事情,现在它不再工作了。{{> Template.dynamic template='navBar‘}}可以工作,所以我的包应该没问题。
Meteor: 1.4软件包: kadira:flow-router,kadira:blaze-layout
导入/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>导入/ui/layouts/mainLayout.js:
import { Template } from 'meteor/templating';
import './mainLayout.html';
import '../components/navBar.html';
import '../pages/settings.html';imports/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>发布于 2017-03-03 23:30:08
此路由:
FlowRouter.route('/', {
action() {
BlazeLayout.render('mainLayout', { content: 'mainLayout' });
},
});是不会起作用的,因为您将mainLayout组件插入到自身中-嵌套的content帮助器才是问题所在。相反,您应该将不同的组件呈现到content中
BlazeLayout.render('mainLayout', { content: 'home' }); // or whatever component should be at "/"https://stackoverflow.com/questions/42582454
复制相似问题