我有以下模板:MeteorJS公佈超出範圍
<template name="reportsContent">
<ul class="tabs">
<li class="tabs-content" data-content="summary">
<div class="tabs-content-wrapper">
{{> reportsSummary }}
</div>
</li>
<li class="tabs-content" data-content="patients">
<div class="tabs-content-wrapper">
{{> reportsPatients }}
</div>
</li>
</ul>
</template>
<template name="reportsSumary">
....
</template>
<template name="reportsPatients">
....
</template>
我已經附上出版物的reportsSummary
模板,但它似乎也延伸到reportsPatients
模板。我不知道爲什麼,因爲我已經遵循了正確的方法來定義酒吧/潛艇(我想...)。
我知道它延伸到reportsPatients
因爲我,如果我從一個reportsPatients
助手返回Appointments.find()
沒有訂閱的出版物,我得到這也是在reportsSummary
這裏的數據是我的刊物:
Meteor.publish('appointments.day.patients', function() {
var thisMonth = new RegExp(moment().format('MMM YYYY'));
return Appointments.find({
date_created: { $regex: thisMonth }
}, { fields: { date_created: 1 } });
});
這是我的訂閱:
Template.reportsSummary.onCreated(function() {
this.subscribe('appointments.day.patients');
});
這並不是說我有什麼正在破壞任何功能本身。我只是擔心效率,當應用程序有一大堆數據,它必須通過篩選。我在這裏錯過了什麼嗎?
出版物沒有範圍。如果數據發佈到客戶端,那麼在訂閱被撤消之前它將在任何地方都可用。 – MasterAM