开始是设置了回到页面使display:none(离开页面操作失效),但是发现回到页面,面板显示,dom获取却为null,于是做了个延时的处理
currentPage: function() {
var hiddenProperty = 'hidden' in document ? 'hidden' : 'webkitHidden' in document ? 'webkitHidden' : 'mozHidden' in document ? 'mozHidden' : null
var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange')
var onVisibilityChange = function() {
if (!document[hiddenProperty]) {
setTimeout(() => {
var div =
document.querySelector('.result')
if (div) { div.style.display = 'none' }
}, 100)
}
}
document.addEventListener(visibilityChangeEvent, onVisibilityChange)
}