Skip to content

Commit 288650e

Browse files
committed
💄 优化弹出窗口过小时弹出菜单显示问题
1 parent 1f29e69 commit 288650e

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/pages/popup/App.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable prettier/prettier */
12
import { Discord, DocumentationSite, ExtVersion } from "@App/app/const";
23
import { Alert, Badge, Button, Card, Collapse, Dropdown, Menu, Switch } from "@arco-design/web-react";
34
import {
@@ -190,6 +191,23 @@ function App() {
190191
<Button type="text" icon={<IconNotification />} iconOnly onClick={handleNotificationClick} />
191192
</Badge>
192193
<Dropdown
194+
onVisibleChange={(visible) => {
195+
if (!visible) return;
196+
// 检查位置,优化窗口过小,导致弹出菜单显示不全的问题
197+
setTimeout(() => {
198+
const dropdowns = document.getElementsByClassName("arco-dropdown");
199+
console.log(dropdowns);
200+
if (dropdowns.length > 0) {
201+
const dropdown = dropdowns[0] as HTMLElement;
202+
console.log(dropdowns, dropdown.style.top);
203+
// 如果top是负数修改为0
204+
if (parseInt(dropdown
205+
.style.top) < 0) {
206+
dropdown.style.top = "0px";
207+
}
208+
}
209+
}, 100);
210+
}}
193211
droplist={
194212
<Menu
195213
style={{

0 commit comments

Comments
 (0)