mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 22:17:40 +08:00
fix(app): listen statusTap event
This commit is contained in:
@ -1,19 +1,22 @@
|
|||||||
import { QueueApi } from '@stencil/core';
|
import { QueueApi } from '@stencil/core';
|
||||||
|
|
||||||
export function startStatusTap(win: Window, queue: QueueApi) {
|
export function startStatusTap(win: Window, queue: QueueApi) {
|
||||||
queue.read(async () => {
|
win.addEventListener('statusTap', () => {
|
||||||
|
queue.read(() => {
|
||||||
const width = win.innerWidth;
|
const width = win.innerWidth;
|
||||||
const height = win.innerWidth;
|
const height = win.innerHeight;
|
||||||
const el = win.document.elementFromPoint(width / 2, height / 2);
|
const el = win.document.elementFromPoint(width / 2, height / 2);
|
||||||
if (!el) {
|
if (!el) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const contentEl = el.closest('ion-content');
|
const contentEl = el.closest('ion-content');
|
||||||
if (contentEl) {
|
if (contentEl) {
|
||||||
await contentEl.componentOnReady();
|
contentEl.componentOnReady().then(() => {
|
||||||
queue.write(() => {
|
queue.write(() => {
|
||||||
contentEl.scrollToTop(300);
|
contentEl.scrollToTop(300);
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user