vant的ImagePreview查看大图,当查看的是gif图的时候,关闭查看大图弹窗,原图不动了,ios上几乎必现。
解决的方案是,监听onclose事件,在关闭的时候把原图的gif图地址重新设置一下就好了
sceneImg(url: string) {
const index = this.imgList.indexOf(url)
ImagePreview({
images: this.imgList, //需要预览的图片 URL 数组
showIndex: true, //是否显示页码
loop: false, //是否开启循环播放
startPosition: index < 0 ? 0 : index, //图片预览起始位置索引
closeable: true,
onClose:()=>{
url = /\?/.test(url) ? `${url}&id=${+new Date()}` : `${url}?id=${+new Date()}`
}
})
}