<repeat for="{{array}}" key="index" index="index" item="item">
<form report-submit="true" @submit="submit" @reset="reset">
<button form-type="submit" class="form_button">
<view class="nr_price {{state==index?‘active-tag‘:‘‘}}" @tap="select_date" data-key=‘{{index}}‘>
{{item.price}}
</view>
</button>
</form>
</repeat>
.nr_price {
margin-top: 29rpx;
float: left;
width: 164rpx;
height: 80rpx;
background: #fff;
box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.15);
border-radius: 10rpx;
margin-right: 30rpx;
font-size: 30rpx;
font-family: PingFang-SC-Regular;
font-weight: 400;
color: #333333;
text-align: center;
line-height: 80rpx;
}
.active-tag {
color: #F83E4D;
}
state: ‘‘,
select_date(e) {
// this.setData({
// state: e.currentTarget.dataset.key,
// });
this.state = e.currentTarget.dataset.key
this.$apply();
}
原文地址:https://www.cnblogs.com/ylblogs/p/10271194.html