Skip to content

Commit

Permalink
沸点添加图片预览功能
Browse files Browse the repository at this point in the history
  • Loading branch information
myvin committed Nov 1, 2018
1 parent 250552f commit 775939d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions components/feidianItem/feidianItemTop/feidianItemTop.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ Component({
}
},
methods: {
preview (e) {
let dataset = e.currentTarget.dataset
let urls = dataset.urls
let index = dataset.index
wx.previewImage({
urls,
current: urls[index],
})
},
toPersonal(e) {
let item = e.currentTarget.dataset.item
wx.navigateTo({
Expand Down
4 changes: 2 additions & 2 deletions components/feidianItem/feidianItemTop/feidianItemTop.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
</view>
<view class='pictures' wx:if='{{item.pictures && item.pictures.length}}'>
<!-- 大于等于两张图片 -->
<view class='picture' style='width:33.33%;' wx:key='{{index}}' wx:for='{{item.pictures}}' wx:for-item='i' wx:if='{{item.pictures.length >= 2}}'>
<view data-index='{{index}}' data-urls='{{item.pictures}}' catchtap='preview' class='picture' style='width:33.33%;' wx:key='{{index}}' wx:for='{{item.pictures}}' wx:for-item='i' wx:if='{{item.pictures.length >= 2}}'>
<image wx:key='{{index}}' style='height:228rpx;' mode='aspectFill' src='{{i}}'></image>
</view>
<!-- 一张图片 -->
<view class='picture' style='width:80%' wx:if='{{item.pictures.length === 1}}'>
<view data-index='{{index}}' data-urls='{{item.pictures}}' catchtap='preview' class='picture' style='width:80%' wx:if='{{item.pictures.length === 1}}'>
<image mode='widthFix' src='{{item.pictures[0]}}'></image>
</view>
</view>
Expand Down

0 comments on commit 775939d

Please sign in to comment.