Commit c753b873 by 程智春

图片画廊itemClick

parent d8251aa5
...@@ -45,6 +45,9 @@ Component({ ...@@ -45,6 +45,9 @@ Component({
* 组件的方法列表 * 组件的方法列表
*/ */
methods: { methods: {
itemClick(e){
let item = e.currentTarget.dataset.item
app.$themeToLink(item.link)
}
} }
}) })
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
{{datas.componentData.titles}} {{datas.componentData.titles}}
</view> </view>
<view wx:if="{{datas.componentData.style==='list'}}"> <view wx:if="{{datas.componentData.style==='list'}}">
<view class="imgcontent" wx:for="{{datas.componentData.imgList}}" wx:key="{{index}}" style="margin-bottom:{{datas.componentData.imgPadding * 2}}rpx"> <view class="imgcontent" bindtap="itemClick" data-item="{{item}}" wx:for="{{datas.componentData.imgList}}" wx:key="{{index}}" style="margin-bottom:{{datas.componentData.imgPadding * 2}}rpx">
<image src="{{item.imageUrl}}" lazy-load mode="widthFix"></image> <image src="{{item.imageUrl}}" lazy-load mode="widthFix"></image>
</view> </view>
</view> </view>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<i class="iconfont-common common-iconyoujiantou"></i> <i class="iconfont-common common-iconyoujiantou"></i>
</view> </view>
<view style="display:{{datas.componentData.style==='tiled' ? 'flex' : ''}}" class="ul"> <view style="display:{{datas.componentData.style==='tiled' ? 'flex' : ''}}" class="ul">
<view wx:for="{{datas.componentData.imgList}}" wx:key="{{index}}" style="margin-right:{{index===(datas.componentData.imgList.length-1)? '' : datas.componentData.imgPadding * 2 + 'rpx'}};width:{{datas.componentData.style==='across' ? datas.componentData.acrossPer+'%' : ''}}" class="li"> <view bindtap="itemClick" data-item="{{item}}" wx:for="{{datas.componentData.imgList}}" wx:key="{{index}}" style="margin-right:{{index===(datas.componentData.imgList.length-1)? '' : datas.componentData.imgPadding * 2 + 'rpx'}};width:{{datas.componentData.style==='across' ? datas.componentData.acrossPer+'%' : ''}}" class="li">
<image src="{{item.imageUrl}}" lazy-load mode="widthFix"></image> <image src="{{item.imageUrl}}" lazy-load mode="widthFix"></image>
</view> </view>
</view> </view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment