You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
841 B
20 lines
841 B
<view class="grid flex-sub padding-lr col-{{column == 3}} grid-square">
|
|
<view class="view-load" style="border-radius: 0rpx;" wx:for="{{imageList}}" wx:key="index" data-index="{{index}}" bindtap="viewImage">
|
|
<van-image width="{{width}}" height="{{width}}" radius="6" src="{{item}}" fit="cover" wx:if="{{checkImage(item)}}"></van-image>
|
|
<van-image width="{{width}}" height="{{width}}" radius="6" src="/assets/image/icon_pdf.svg" fit="cover" wx:else></van-image>
|
|
</view>
|
|
</view>
|
|
|
|
<wxs module="checkImage">
|
|
function checkImage(url) {
|
|
if (url.indexOf('.png') >= 0 || url.indexOf('.PNG') >= 0) {
|
|
return true
|
|
} else if (url.indexOf('.jpg') >= 0 || url.indexOf('.JPG') >= 0) {
|
|
return true
|
|
} else if (url.indexOf('.jpeg') >= 0 || url.indexOf('.JPEG') >= 0) {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
module.exports = checkImage
|
|
</wxs>
|