mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-15 23:47:33 +08:00
after the search bar is focused and the screen height is reduced, let the sheet scroll to top
This commit is contained in:
@@ -140,6 +140,24 @@ export function scrollToSelectedItem(parentEl: Framework7Dom, containerSelector:
|
||||
container.scrollTop(targetPos);
|
||||
}
|
||||
|
||||
export function scrollSheetToTop(sheetElement: HTMLElement | undefined, windowNormalInnerHeight: number): void {
|
||||
if (!sheetElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const sheetHeight = sheetElement.offsetHeight;
|
||||
|
||||
if (sheetHeight < windowNormalInnerHeight) {
|
||||
setTimeout(() => {
|
||||
const windowNewInnerHeight = window.innerHeight;
|
||||
|
||||
if (windowNewInnerHeight < windowNormalInnerHeight && sheetHeight < windowNewInnerHeight) {
|
||||
window.scrollTo({ top: windowNormalInnerHeight - sheetHeight - 24, behavior: "smooth" });
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
export function useI18nUIComponents() {
|
||||
const { tt, te } = useI18n();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user