We often have comments on services or items. the general method is five stars, and the rating is quickly achieved through touch. We often have comments on services or items. the general method is five stars, and the rating is quickly achieved through touch.
Let's take a look at the implementation:
WXML code
Description
JS code
Page({ data:{ flag:0 }, changeColor1:function(){ var that = this; that.setData( { flag: 1 }); }, changeColor2:function(){ var that = this; that.setData( { flag:2 }); }, changeColor3:function(){ var that = this; that.setData( { flag: 3 }); }, changeColor4:function(){ var that = this; that.setData( { flag:4
Here, the specific value of this score is controlled and determined by the variation of the flag value of a variable.
Bind an event function for each star to change the score to set the value change.
WCSS code
/* Star Style */. stars {background-image: url ("http://m.dev.vd.cn/static/xcx/v1/goo/star ()@1.5x.png"); width: 43rpx; height: 43rpx; background-size: 43rpx 43rpx; margin-left: 40rpx ;}. on {background-image: url ("http://m.dev.vd.cn/static/xcx/v1/goo/star@1.5x.png"); width: 43rpx; height: 43rpx; background-size: 43rpx 43rpx;/* margin-left: 10px ;*/}
For more articles related to five-star reviews in small programs, please follow the PHP Chinese website!