From 5fd53acab01d5a2772a1ca76496436420b9f8ca3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=BB=9B=E4=BA=BD?=
<83791825+Soltus@users.noreply.github.com>
Date: Sun, 9 Apr 2023 09:35:18 +0800
Subject: [PATCH] Resolve invalid non-full-screen menus on the mobile (#7912)
* Update Menu.ts
* Update Menu.ts
---
app/src/menus/Menu.ts | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.ts
index 50f9c9cc1..0c9a3ef20 100644
--- a/app/src/menus/Menu.ts
+++ b/app/src/menus/Menu.ts
@@ -126,12 +126,21 @@ export class Menu {
`);
+ this.popup({x: 0, y: position === "bottom" ? window.innerHeight / 2 : 0});
if (position === "bottom") {
this.element.querySelectorAll(".b3-menu__submenu").forEach((item: HTMLElement) => {
- item.style.top = "calc(50vh + 48.5px)";
+ item.style.top = "calc(100vh - 500px + 48.5px)";
+ });
+ // 解决部分机型非全屏菜单无效
+ // 解决方案一,对应的 item.style.top 为 calc(50vh + 48.5px)
+ // this.element.style.top = "50vh";
+ // 解决方案二,需要联动上面的 item.style.top
+ this.element.style.position = "sticky";
+ this.element.style.height = "500px";
+ this.element.querySelectorAll(".b3-menu__separator").forEach((item: HTMLElement) => {
+ item.style.pointerEvents = "none"; // 解决手机端分割线点击交互陷阱
});
}
- this.popup({x: 0, y: position === "bottom" ? window.innerHeight / 2 : 0});
this.element.scrollTop = 0;
}
}