mounted () {
this.closePreview()
},
// 返回关闭弹窗
closePreview () {
// 图片游览按返回键退出游览
this.$preview.on('imageLoadComplete', (e, item) => {
let _preview = this.$preview.self
let lookUrl = window.location.href + '&look'
window.history.pushState(null, null, lookUrl)
_preview.listen('close',
function () {
if (window.location.href.indexOf('&look') !== -1) {
window.history.go(-1)
}
})
window.addEventListener('popstate', function (e) {
if (_preview !== null && _preview !== undefined) {
_preview.close()
_preview = null
}
})
})
},
vue-photo-preview在移动端系统返回时图片未关闭
于 2023-10-10 11:50:43 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)