wxml
<view class="qiandao-hua" wx:for="{{circle}}" data-index="{{index}}" data-item="{{item.id}}">
<view class="qiandao-circle{{index}} {{circleId ==item.id?'circleselected':''}}" bindtap="circle" data-id="{{item.id}}" data-amount="{{item.amount}}"></view>
</view>
js
/*点击签到 */
circle:function(e){
console.log(e)
var arr=[7];
var circleId=e.currentTarget.dataset.id;
var squareId = e.currentTarget.dataset.id;
arr = circleId;
for (var i = 0; i <=squareId;i++){
if (arr[i]!=i)
{
console.log("请按顺序签到哦,才能获取奖励" + e.currentTarget.dataset.amount);
console.log(arr)
break;
}
else
{
console.log("点击了奖励"+e.currentTarget.dataset.amount)
wx.setStorage({
key: 'itemId',
data: 'circleId',
data: 'squareId',
})
this.setData({
circleId: circleId,
squareId: squareId,
});
console.log(arr)
}
}
},
点击圆点,需要获取数组的信息来判断前面的圆点是否已经被选中,但是数组缓存不了,缓存一个后面新寸的酒会被覆盖,求大神指点
https://developers.weixin.qq.com/s/woCWI8mD7JcA