mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
22 lines
597 B
TypeScript
22 lines
597 B
TypeScript
import { readTask, writeTask } from '@stencil/core';
|
|
|
|
export const startStatusTap = () => {
|
|
const win = window;
|
|
win.addEventListener('statusTap', () => {
|
|
readTask(() => {
|
|
const width = win.innerWidth;
|
|
const height = win.innerHeight;
|
|
const el = document.elementFromPoint(width / 2, height / 2) as (Element | null);
|
|
if (!el) {
|
|
return;
|
|
}
|
|
const contentEl = el.closest('ion-content');
|
|
if (contentEl) {
|
|
contentEl.componentOnReady().then(() => {
|
|
writeTask(() => contentEl.scrollToTop(300));
|
|
});
|
|
}
|
|
});
|
|
});
|
|
};
|