Compare commits

...

2 Commits

Author SHA1 Message Date
huangzhen fe98115a5e Merge branch 'feature-main' into test 2024-11-04 19:06:35 +08:00
huangzhen 6607661d26 update @可见性判断唯一处理 2024-11-04 19:06:22 +08:00
3 changed files with 12 additions and 0 deletions

View File

@ -174,6 +174,7 @@ export default {
interceptCode: [ ...interceptCode ],
passCode: [ ...passCode ],
pollSwitch: false, //
visibilityStatus: false,
showData: ['31', '32', '33', '2', '1'] as Array<any>, //
pageData: new Map([['31', []], ['32', []], ['33', []], ['2', []], ['1', []]]),
@ -317,6 +318,8 @@ export default {
methods: {
//
visibilityFunc() {
if (this.visibilityStatus) return;
this.visibilityStatus = true;
const that = this;
document.addEventListener('visibilitychange', function () {
const visibilityState = document.visibilityState;
@ -688,6 +691,7 @@ export default {
}
},
beforeUnmount() {
this.visibilityStatus = false;
document.removeEventListener('visibilitychange', this.visibilityFunc);
this.codeTime && clearInterval(this.codeTime);
this.codeTime = null;

View File

@ -143,6 +143,7 @@ export default {
passCode: [ ...passCode ],
weekArray: [ ...weekArray ],
pollSwitch: false, //
visibilityStatus: false,
bgDefault: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/common_img_main_1.png',
bgInput: 'https://lsxdmgoss.oss-cn-chengdu.aliyuncs.com/MarketingSystem/image/front/zfb-red-banner.png',
@ -192,6 +193,8 @@ export default {
methods: {
//
visibilityFunc() {
if (this.visibilityStatus) return;
this.visibilityStatus = true;
const that = this;
document.addEventListener('visibilitychange', function () {
const visibilityState = document.visibilityState;
@ -361,6 +364,7 @@ export default {
}
},
beforeUnmount() {
this.visibilityStatus = false;
document.removeEventListener('visibilitychange', this.visibilityFunc);
this.pollTime && clearTimeout(this.pollTime);
this.pollTime = 'end';

View File

@ -117,6 +117,7 @@ export default {
passCode: [ ...passCode ],
weekArray: [ ...weekArray ],
pollSwitch: false, //
visibilityStatus: false,
};
},
created() {
@ -130,6 +131,8 @@ export default {
methods: {
//
visibilityFunc() {
if (this.visibilityStatus) return;
this.visibilityStatus = true;
const that = this;
document.addEventListener('visibilitychange', function () {
const visibilityState = document.visibilityState;
@ -290,6 +293,7 @@ export default {
}
},
beforeUnmount() {
this.visibilityStatus = false;
document.removeEventListener('visibilitychange', this.visibilityFunc);
this.pollTime && clearTimeout(this.pollTime);
this.pollTime = 'end';