修复日志滚动逻辑

This commit is contained in:
whyour
2023-09-12 22:28:26 +08:00
parent 742d0b2135
commit 748a099087
4 changed files with 11 additions and 7 deletions
+4 -3
View File
@@ -82,12 +82,12 @@ const CronLogModal = ({
handleCancel();
};
const handleScroll = (e) => {
const sTop = e.target.scrollTop;
const handleScroll: React.UIEventHandler<HTMLDivElement> = (e) => {
const sTop = (e.target as HTMLDivElement).scrollTop;
if (scrollInfoRef.current.down) {
scrollInfoRef.current = {
value: sTop,
down: sTop > scrollInfoRef.current.value,
down: sTop > scrollInfoRef.current.value || !sTop,
};
}
};
@@ -105,6 +105,7 @@ const CronLogModal = ({
useEffect(() => {
if (cron && cron.id && visible) {
getCronLog(true);
scrollInfoRef.current.down = true;
}
}, [cron, visible]);