【发布时间】:2016-10-23 00:03:38
【问题描述】:
routes.js
Router.route('/', function () {
this.render('Home');
});
Router.route('wall', function () {
this.render('Wall');
});
landing.html
<template name="home">
...
</template>
drawingApp.html
<body>
{{> wall}}
</body>
<template name="wall">
...
{{> canvas}}
...
</template>
<template name="canvas">
...
</template>
drawingApp.js
...
Template.wall.events({
...
如果我包含 <body> {{> wall}} </body>,则着陆页会呈现在应用下方。如果我删除<body> {{> wall}} </body>,登陆页面会正确呈现,但是当点击按钮进入时,它会打开一个无法运行的应用程序。 (自从第一次发布尝试了很多事情后进行了编辑,但核心问题保持不变)。有任何想法吗?谢谢你。
【问题讨论】:
-
你在使用
iron-router吗?如果是这样,请去掉<head>和<body>标签。 Iron 路由器在路线上添加了自己的头部/身体。看看这是否适合你。 -
是的,我正在使用 Iron:router。我将头部中的脚本标签拉出并添加到流星包中,但 home.html 仍然呈现在应用程序下方。如果我去掉 {{> wall}} ,我的绘图应用就会失去功能。
-
例如.js中
Template.wall.events({ "click button.clear": function (event) { Meteor.call('clear', function() { canvas.clear(); }); }, "click button.darkblue": function () { lastX=0; lastY=0; strokeColor = "darkblue"; opacity = "1"; },
标签: templates meteor canvas routing