no message

This commit is contained in:
kuaifan 2025-04-10 16:48:35 +08:00
parent 208598a6df
commit bfb9795913
2 changed files with 61 additions and 0 deletions

View File

@ -1343,6 +1343,60 @@ const timezone = require("dayjs/plugin/timezone");
}
throw new Error('等待条件超时');
},
/**
* 执行指定次数的定时任务返回一个可以取消的对象
* @param {Function} fn 要执行的函数
* @param {number} interval 间隔时间(毫秒)
* @param {number} times 执行次数
* @returns {object} 包含 clear 方法的对象
*/
repeatWithCount(fn, interval, times) {
if (typeof fn !== 'function') {
return () => {}; // 返回空函数而不是null保持返回类型一致
}
if (interval < 0 || times < 0) {
return () => {}; // 返回空函数
}
let count = 0;
let timer = null;
const clear = () => {
if (timer) {
clearTimeout(timer);
timer = null;
}
};
const execute = () => {
if (count >= times) {
clear();
return;
}
try {
if (fn(count) === true) {
clear();
return;
}
} catch (error) {
clear();
console.error('Error in callback function:', error);
return;
}
count++;
timer = setTimeout(execute, interval);
};
// 立即开始第一次执行
timer = setTimeout(execute, 0);
// 直接返回clear函数
return clear;
}
});

View File

@ -2356,6 +2356,13 @@ export default {
this.focusTimer && clearTimeout(this.focusTimer)
this.focusLazy = true
this.$emit("on-focus")
//
if ($A.isIos()) {
this.tempRepeat && this.tempRepeat()
this.tempRepeat = $A.repeatWithCount(() => {
this.$refs.footer.scrollIntoView({block: 'end'})
}, 50, 10)
}
},
onEventBlur() {