作者:Pluto,来自授权地址,本文作者还制作了另外一个不错的东西,在相关文章内;
效果图:
核心代码:
1
2
3
4
5
6
7
8
9
10
11
12
selectCommentType: function (e) { console.log('选中的是第几条评论的哪一种类型', e.currentTarget.dataset); var commentList = this.data.commentList; var index = parseInt(e.currentTarget.dataset.index); commentList[index].commentType = e.currentTarget.dataset.type; this.setData({ 'commentList': commentList }); }1
2
3
4
5
6
7
8
9
10
完整代码:
wxml
<form> <view class="order_comment_bg"> <view wx:for="{{commentList}}" style="background:#fff;"> <view class="order_comment_item"> <view class="weui-flex order_comment_content bottom_border"> <view> <view class="placeholder"> <image src=http://www.yiyongtong.com/archives/"{{item.commodityIcon}}" class="order_comment_img"></image> </view> </view