问题:为什么所有元素都出现加载符号而不是星星(星星不显示),除了第一个
代码:
foreach($posts as $post):
<span class="star-container">
debug($post->post_rate);
echo StarRating::widget([
'model' => $post,
'attribute' => 'post_rate',
'pluginOptions' => [
'size'=>'xs',
'filledStar' => '★',
'emptyStar' => '☆',
]
]);
</span>
endforeach;
尝试为您的小部件添加 ID 或名称。
echo StarRating::widget([
'model' => $post,
'id' => $post->id
'attribute' => 'post_rate',
'pluginOptions' => [
'size'=>'xs',
'filledStar' => '★',
'emptyStar' => '☆',
]
]);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句