💪 optimize: 优化代码

This commit is contained in:
wangsongsole 2024-03-25 19:36:25 +08:00
parent efac811246
commit c7b956bbf7
4 changed files with 36 additions and 12 deletions

View File

@ -157,11 +157,17 @@
/* 倒计时 */ /* 倒计时 */
const key_expiration_time = sessionStorage.getItem('key_expiration_time'); const key_expiration_time = sessionStorage.getItem('key_expiration_time');
if (key_expiration_time != 0) { if (key_expiration_time != 0) {
setInterval(() => { const cls = setInterval(() => {
this.outTime = pageOutTime(key_expiration_time); const time = pageOutTime(key_expiration_time);
if (time) {
this.outTime = time;
} else {
this.outTime = ['00', '00', '00'];
clearInterval(cls);
}
}, 1000); }, 1000);
} else { } else {
this.outTime = []; this.outTime = ['00', '00', '00'];
} }
}, },

View File

@ -186,11 +186,17 @@
/* 倒计时 */ /* 倒计时 */
const key_expiration_time = sessionStorage.getItem('key_expiration_time'); const key_expiration_time = sessionStorage.getItem('key_expiration_time');
if (key_expiration_time != 0) { if (key_expiration_time != 0) {
setInterval(() => { const cls = setInterval(() => {
this.outTime = pageOutTime(key_expiration_time); const time = pageOutTime(key_expiration_time);
if (time) {
this.outTime = time;
} else {
this.outTime = ['00', '00', '00'];
clearInterval(cls);
}
}, 1000); }, 1000);
} else { } else {
this.outTime = []; this.outTime = ['00', '00', '00'];
} }
}, },
filters: { filters: {

View File

@ -152,11 +152,17 @@
/* 倒计时 */ /* 倒计时 */
const key_expiration_time = sessionStorage.getItem('key_expiration_time'); const key_expiration_time = sessionStorage.getItem('key_expiration_time');
if (key_expiration_time != 0) { if (key_expiration_time != 0) {
setInterval(() => { const cls = setInterval(() => {
this.outTime = pageOutTime(key_expiration_time); const time = pageOutTime(key_expiration_time);
if (time) {
this.outTime = time;
} else {
this.outTime = ['00', '00', '00'];
clearInterval(cls);
}
}, 1000); }, 1000);
} else { } else {
this.outTime = []; this.outTime = ['00', '00', '00'];
} }
}, },
filters: { filters: {

View File

@ -151,11 +151,17 @@
/* 倒计时 */ /* 倒计时 */
const key_expiration_time = sessionStorage.getItem('key_expiration_time'); const key_expiration_time = sessionStorage.getItem('key_expiration_time');
if (key_expiration_time != 0) { if (key_expiration_time != 0) {
setInterval(() => { const cls = setInterval(() => {
this.outTime = pageOutTime(key_expiration_time); const time = pageOutTime(key_expiration_time);
if (time) {
this.outTime = time;
} else {
this.outTime = ['00', '00', '00'];
clearInterval(cls);
}
}, 1000); }, 1000);
} else { } else {
this.outTime = []; this.outTime = ['00', '00', '00'];
} }
}, },