Home  >  Article  >  WeChat Applet  >  WeChat mini program five-star evaluation function production

WeChat mini program five-star evaluation function production

高洛峰
高洛峰Original
2018-05-12 11:28:405223browse

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 >&#39;0&#39;? &#39;cur icon&#39; : &#39;icon&#39;}}" data-id="1"></icon>
    <icon class="{{tabArr.curHdIndex >&#39;1&#39;? &#39;cur icon&#39; : &#39;icon&#39;}}" data-id="2"></icon>
    <icon class="{{tabArr.curHdIndex >&#39;2&#39;? &#39;cur icon&#39; : &#39;icon&#39;}}" data-id="3"></icon>
    <icon class="{{tabArr.curHdIndex >&#39;3&#39;? &#39;cur icon&#39; : &#39;icon&#39;}}" data-id="4"></icon>
    <icon class="{{tabArr.curHdIndex >&#39;4&#39;? &#39;cur icon&#39; : &#39;icon&#39;}}" 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn