mounted() {
document.addEventListener('visibilitychange', _this.handleVisiable)
},
destroyed() {
document.removeEventListener('visibilitychange', _this.handleVisiable)
},
methods: {
handleVisiable(e) {
if (e.target.visibilityState === 'visible') {
// 要执行的方法
}
}
Vue利用visibilitychange监听页面显示和隐藏
最新推荐文章于 2024-04-13 15:50:45 发布