简体   繁体   English

流星中如何在没有JavaScript的情况下呈现模板?

[英]How to render template without JavaScript in meteor?

I am using iron:router in meteor. 我在流星中使用iron:router In my case I wanna include Template in an Iframe. 就我而言,我想将模板包含在iframe中。

template.html template.html

<iframe src="{{pathFor 'MyTemplate'}}" width="100%"></iframe>

route.js route.js

this.route('MyTemplate', {path: '/MyTemplate',layoutTemplate:'MyTemplate'});

When I render this temple in an iframe. 当我在iframe中渲染此寺庙时。 It render with javascript and CSS. 它使用javascript和CSS呈现。 I need only css here. 我只需要CSS。 Is there anyway to restrict the JavaScript in specific route. 无论如何,有没有限制JavaScript的特定路径。

I'm not sure if its quite what you want but you can render HTML without meteor adding the javascript by doing this kind of thing: 我不确定它是否正是您想要的,但是您可以通过做这种事情来呈现HTML而无需流星添加javascript:

Router.route('/MyTemplate', function () {
 this.response.end('<html><h1> hello world </h1></html>');
  }, {where: 'server'});
});

with that code in the server section. 服务器部分中的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM