js:
data: {
stars: {
stars: [1,1,1,0,0],
},
},
onLoad: function (options) {
},
changeBoolen: function (e) {
var num = (e.currentTarget.dataset.index+1)*10;
this.setData({
stars:util.convertToStarsArray(num),
score:num
})
}
wxml:
<block wx:for="{{stars}}" wx:for-item='i' >
<image wx:if='{{i}}' data-index='{{index}}' src='/images/icon/star.png' catchtap='changeBoolen' />
<image wx:else data-index='{{index}}' src="/images/icon/none-star.png" catchtap='changeBoolen' />
4年同步微信官方迭代,累计20000+人学习, 比微信官方更火爆!
了解课程