页面结构
1 2 3
| <view class="seat-detail"> <view wx:for="{{seatarr}}" wx:key="id" wx:for-item="v" class="seat-item {{v.usable==1?'':'disable'}} {{selectedSeatId == v.seat_id ? 'active' : ''}}" data-id="{{v.seat_id}}" data-status="{{v.usable}}" bindtap="checkseat">{{v.number}}</view> </view>
|
js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| checkseat: function (e) { var status = e.currentTarget.dataset.status; var id = e.currentTarget.dataset.id; if (status == 1) { this.setData({ selectedSeatId: id }) }else{ wx.showToast({ title: '这个座位不能选!', icon: 'loading', duration: 1500 }) setTimeout(function () { wx.hideToast() }, 2000) } }
|