Javascript meteor:FS系列中带有图片的产品网格
我想做一个“合作伙伴”集合的网格 每个合作伙伴由一个partnerGridForm模板组成Javascript meteor:FS系列中带有图片的产品网格,javascript,meteor,Javascript,Meteor,我想做一个“合作伙伴”集合的网格 每个合作伙伴由一个partnerGridForm模板组成 <template name="partnerGridForm"> <div class="col-sm-4"> <div class="panel panel-default"> {{_id}} {{#each profileImages}} {{>partnerGridImage}}
<template name="partnerGridForm">
<div class="col-sm-4">
<div class="panel panel-default">
{{_id}}
{{#each profileImages}}
{{>partnerGridImage}}
{{/each}}
<h3 class="panel-title">{{profile.partner_company}}</h3>
<hr>
{{profile.partner_address_line_1}}<br>
{{#if profile.partner_address_line2}}
{{profile.partner_address_line2}}<br>
{{/if}}
{{profile.partner_zipcode}} {{profile.partner_city}}<br>
{{profile.partner_state}} - {{profile.partner_country}}<br>
{{profile.partner_phone_nr}}<br>
{{profile.partner_mobile_nr}}<br>
<hr>
<b>
{{profile.partner_category}}<br>
{{profile.partner_sub_category}}</b>
<hr>
{{{profile.partner_promo_text}}}
</div><!-- end panel -->
</div><!-- end feature -->
</template>
以及partnerGridForm模板上的以下帮助程序
Template.partnerGridForm.helpers({
profileImages: function() {
return PartnerImages.find();
},
});
Template.partnerGridForm.onRendered(function(event,template){
currentPartner = Template.currentData() // Get current data in template
currentPartnerId = currentPartner._id;
if (typeof ImageSub !== 'undefined') {
if ( ImageSub != null ) {
ImageSub.stop();
};
};
ImageSub = Meteor.subscribe('partnerImages', currentPartnerId);
});
问题是partnerGridForm上的帮助程序会更新渲染的每个表单,以便每个表单始终获得最后一张图像
有人能帮忙吗?你能更具体地说明你遇到了什么问题吗?是因为你不想更新图片吗?还是你不知道如何制作一个助手来显示图片?查看您的partnerGridImage帮助程序可能会有所帮助。我已将帮助程序代码添加到问题中!顺致敬意,
// Template Helpers
Template.partnerGrid.helpers({
partners: function () {
return Meteor.users.find();
},
});
// On rendering get lists
Template.partnerGrid.onRendered(function (event,template) {
if (typeof partnerSub !== 'undefined') {
if ( partnerSub != null ) {
partnerSub.stop();
};
};
partnerSub = Meteor.subscribe('partnerList');
});
Template.partnerGridForm.helpers({
profileImages: function() {
return PartnerImages.find();
},
});
Template.partnerGridForm.onRendered(function(event,template){
currentPartner = Template.currentData() // Get current data in template
currentPartnerId = currentPartner._id;
if (typeof ImageSub !== 'undefined') {
if ( ImageSub != null ) {
ImageSub.stop();
};
};
ImageSub = Meteor.subscribe('partnerImages', currentPartnerId);
});