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.
19 lines
715 B
19 lines
715 B
<van-image width="{{width}}" height="{{height}}" src="{{src}}" fit="cover" lazy-load radius="6" wx:if="{{checkImage(src)}}"></van-image>
|
|
<van-image width="{{width}}" height="{{height}}" src="/assets/image/icon_pdf.svg" lazy-load radius="6" fit="cover" wx:else></van-image>
|
|
|
|
<wxs module="checkImage">
|
|
function checkImage(url) {
|
|
if(typeof url === 'undefined' || url === '' || url === null){
|
|
return true
|
|
}
|
|
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>
|