【发布时间】:2013-07-30 14:02:06
【问题描述】:
为什么模板的渲染次数与我的模板中的 Each 相关。
<template name="carousel">
<div class="pikachoose">
<ul class="carousel" >
{{#each article}}
<li><a href="#"><img src="{{image}}" width="500" height="250" alt="picture"/></a><span>{{caption}}</span></li>
{{/each}}
</ul>
</div>
</template>
Template.carousel.article = function () {
return News.find({},{limit: 3});
}
Template.carousel.rendered = function() {
//$(".pika-stage").remove();
alert($(".carousel").html());
//$(".carousel").PikaChoose({animationFinished: updateNewsPreview});
}
在这种情况下,它会警告 3 次。
【问题讨论】: