document.addEventListener('visibilitychange', handleListenVisibilityChange);
const handleListenVisibilityChange = () => {
const hiddenProperty = 'hidden' in document ? 'hidden' : 'webkitHidden' in document ? 'webkitHidden' : 'mozHidden' in document ? 'mozHidden' : null;
if (document && document[hiddenProperty]) {
handleReset();
console.log('H5已切换到后台或手机息屏');
} else {
handleReset();
}
};
小程序WebView内置H5如何监听息屏
最新推荐文章于 2024-06-24 14:37:41 发布