五星评分,让我告诉你半颗星星怎么做
请戳“ 极客 小寨 ”关注 一起聊聊 技术 ! 1 概述 我们在学习微信小程序或者做项目时,应该会遇到 五星评分 效果情况,那么这个五星评分,半颗星星怎么做功能我们应该怎么编写呢? 今天我们说下微信小程序 五星评分,半颗星星 效果 的实现, 今天分享这样的小教程。希望对大家有所帮助 。 不多说了,二当家要上图啦! 快去拿个小板凳,坐等跟多更新 2 wxml <!--index.wxml--> < block wx:for = "{{stars}}" wx:key = "" > < image class = "star-image" style = "left: {{item*150}}rpx" src = "{{key > item ?(key-item == 0.5?halfSrc:selectedSrc) : normalSrc}}" > < view class = "item" style = "left:0rpx" data-key = "{{item+0.5}}" bindtap = "selectLeft" > </ view > < view class = "item" style = "left:75rpx" data-key = "{{item+1}}" bindtap = "selectRight" > </ view > </ image > </