mounted() {
this.zoomOutPause();
}
第二步方法
// 窗口缩小暂停
zoomOutPause() {
// if (this.studyVis) {
let isMinimized = false; // 标识窗口是否处于最小化状态
window.addEventListener("visibilitychange", () => {
if (document.visibilityState === "hidden") {
// 屏幕最小化,暂停计时器
clearInterval(this.intervalTime);
clearInterval(this.intervalId);
clearInterval(this.timer);
isMinimized = true;
} else {
// 屏幕重新显示
if (isMinimized && this.isRunning) {
// 之前处于最小化状态,启动计时器
// this.GetTransferTime(true);
clearInterval(this.intervalTime);
clearInterval(this.intervalId);
clearInterval(this.timer);
if (this.studyVis) {
this.runningMethod(true);
this.countStudyTime(true);
this.insertVideoStudy();
}
isMinimized = false;
}
}
});
// }
},