var
app = getApp()
var
count
= 0;
Page({
data: {
stars: [0, 1, 2, 3, 4],
normalSrc:
'/images/icon/star-no.png'
,
selectedSrc:
'/images/icon/star-full.png'
,
halfSrc:
'/images/icon/star-half.png'
,
key: 0,
status:
''
,
* 生命周期函数--监听页面加载 */
onLoad:
function
(options) {
console.log(options.status) },
selectLeft:
function
(e) {
var
key = e.currentTarget.dataset.key
if
(this.data.key == 0.5 && e.currentTarget.dataset.key == 0.5) {
key = 0; }
count
= key
this.setData({
key: key })
},
selectRight:
function
(e) {
var
key = e.currentTarget.dataset.key
count
= key
this.setData({
key: key })
},
startRating:
function
(e) {
wx.showModal({
title:
'分数'
,
content:
""
+
count
,
success:
function
(res) {
if
(res.confirm) {
console.log(
'用户点击确定'
) }
}
})
}
})