引入js文件
<script type="text/javascript" src="jweixin-1.1.0.js"></script>
方法1:
#content 为 此id 范围内的图片可预览
function imgPreview() {
$("#content").delegate('img','click','img',function(){
var imgsurl=[];
var nowurl='';
var imgObj=$("#content img");
for(var i=0;i<imgObj.length;i++){
imgsurl[i]=imgObj[i].src;
imgObj[i].onclick=function(){
nowurl=this.src;
wx.previewImage({
current: nowurl,
urls: imgsurl
});
}
}
})
}
方法2:
点击图片预览
<img src="../res/image/zsbxjh_2.jpg" @click="imgShow($event)">
imgShow (event) {
var currEl = event.currentTarget;
var url = $(currEl)[0].src;
wx.previewImage({
current:url,
urls:[url]
})
},