我正在学习meteor框架。我正在尝试呈现模板,但它抛出了这个错误:
Errors prevented startup:
While processing files with static-html (for target web.browser):
client/html/sidebar.html:1: Expected <head> or <body> tag我的layout.html文件是这样的:
<body>
{{> sidebar}}
</body>sidebar.html文件是这样的:
<template name="sidebar">
<h1>Hello</h1>
</template>为什么它不能在layout.html上渲染?
发布于 2017-11-14 18:07:45
将body标记替换为一个名为“layoutTemplate”的模板(例如),并使此模板成为路由器配置中的布局。
<template name="layout">
{{> sidebar}}
{{> yield}}
</template>以IronRouter为例:
Router.configure({
layoutTemplate: 'layout'
});发布于 2017-11-15 15:07:55
看起来您的问题是您使用的是static-html包,而不是blaze-html-templates,这意味着所有模板代码都不会被处理
执行以下操作:
meteor remove static-html
meteor add blaze-html-templates在您的项目文件夹中,并查看这是否有帮助
https://stackoverflow.com/questions/47282606
复制相似问题