該行{{> Template.dynamic template = content}}使得我的頁面無法加載。有時它實際上會使我的瀏覽器崩潰。我讓它工作了一段時間,但發生了一些事情,現在它不再工作了。 {{> Template.dynamic template ='navBar'}}有效,所以我的包應該沒問題。流星動態模板不起作用
流星:1.4 套餐:kadira:流路由器,kadira:閃耀佈局
進口/ UI /佈局/ 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 /佈局/ mainLayout。 JS:
import { Template } from 'meteor/templating';
import './mainLayout.html';
import '../components/navBar.html';
import '../pages/settings.html';
進口/啓動/客戶/ 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 /網頁/ settings.html:
<template name="settings">
<div class="container">
<h1>This is the settings page</h1>
</div>
</template>
所以,你正在佈局內的佈局? 'BlazeLayout.render('mainLayout',{content:'mainLayout'});' – chazsolo