图片点击放大即wx.previewimage时会触发onhide,预览返回时会触
发布于 6 年前 作者 minlu 6190 次浏览 来自 问答

图片点击放大即wx.previewimage时会触发onhide,预览返回时会触发onshow

2 回复

1 首先在data中定义一个变量比如 preImgStatus: false

2. 在上述代码调用previewImage前加一个开关变量    this.setData({preImgStatus: true})

3. 在显示放大图片时触发的onhide函数中加上

if(this.data.preImgStatus == true) {
    this.setData({ preImgStatus: false});
    return;
}
//此处加上onhide真正需要处理的事件即可,onshow同理

没毛病。。跳出小程序,进入了微信环境呀~

分享的时候,wx.openLocation的时候,wx.chooseImage的时候,不都这样吗

回到顶部