小程序————图片预览

 wxml:

<view>
<view wx:for="{{imgalist}}" wx:for-item="image">
<image src="{{image}}" data-src="{{image}}"  bindtap="previewImage"></image>
</view>
</view>

JS:

data:{
imgalist:['连接',]
}
previewImage:function(e)
{
var current=e.target.dataset.src;
wx.previewImage({
current:current,
urls:this.data.imgalist
})
}

图片的链接只能是网络地址,不能是本地地址。

猜你喜欢

转载自blog.csdn.net/abenazhan/article/details/80346087