This article mainly introduces the relevant information on the implementation of the five-star evaluation function of the WeChat Mini Program. Here is attached the example code and implementation renderings. Friends in need can refer to
WeChat Mini Program Five-Star Evaluation function
Without further ado, let’s take a look at the renderings:
The effect to be achieved: Click on which star, It is necessary to display the number of stars,
Next, check the source code directly:
<view class="l-evalbox row"> <text class="l-evaltxt">满意度:</text> <view class="l-evalist flex-1" bindtap="chooseicon"> <icon class="{{tabArr.curHdIndex >'0'? 'cur icon' : 'icon'}}" data-id="1"></icon> <icon class="{{tabArr.curHdIndex >'1'? 'cur icon' : 'icon'}}" data-id="2"></icon> <icon class="{{tabArr.curHdIndex >'2'? 'cur icon' : 'icon'}}" data-id="3"></icon> <icon class="{{tabArr.curHdIndex >'3'? 'cur icon' : 'icon'}}" data-id="4"></icon> <icon class="{{tabArr.curHdIndex >'4'? 'cur icon' : 'icon'}}" data-id="5"></icon> </view> </view>
The css is as follows:
.l-evalbox{ height: 100rpx; padding: 0 3%; margin-top: 10rpx; background: #FFF; line-height: 100rpx; } .l-evaltxt{ width: 120rpx; display: block; font-size: 26rpx; color: #666666; } .l-evalist .icon{ background-position: -77rpx -246rpx; width: 40rpx; height: 43rpx; margin-right: 30rpx; } .l-evalist .cur{ background-position: -128rpx -246rpx; } .l-evalist .icon:last-child{ margin: 0; }
The js code is as follows:
chooseicon:function(e){ var strnumber=e.target.dataset.id; var _obj={}; _obj.curHdIndex=strnumber; this.setData({ tabArr: _obj }); },
Like this The effect is shown as follows:
#Thanks for reading, I hope it helps everyone, thank you for your support of this site!
The above is the detailed content of WeChat mini program five-star evaluation function production. For more information, please follow other related articles on the PHP Chinese website!