在某些情况下Meteor中是否有办法停止渲染模板?我发现这有效:
Template.test.created = function () {
if (/* conditions */) {
this.view.template.renderFunction = function () {
return null;
};
}
};
但是......也许有人能做得更好吗?
答案 0 :(得分:0)
最好在模板/助手本身内完成此任务。
<template name="sometimesVisible">
{{#if visible}}
<!-- content here -->
{{/if}}
</template>
Template.sometimesVisible.helpers({
visible: function() {
// conditions here
}
]);