Skip to content

Commit f14b538

Browse files
authored
🐛 修复弹出内容跟随屏幕滚动的问题 (#1263)
* 修复弹出内容跟随屏幕滚动的问题 - v2 * lint
1 parent 7dcef39 commit f14b538

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/pages/components/layout/MainLayout.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,18 @@ const MainLayout: React.FC<{
295295
}}
296296
locale={arcoLocale(i18n.language)}
297297
componentConfig={{
298-
Popconfirm: {
298+
Select: {
299299
getPopupContainer: (node) => {
300-
return node.parentNode as Element;
300+
return node;
301301
},
302302
},
303303
}}
304304
getPopupContainer={(node) => {
305-
return node;
305+
let p = node.parentNode as Element;
306+
p = (p.closest("button")?.parentNode as Element) || p; // 確保 ancestor 沒有 button 元素
307+
p = (p.closest("span")?.parentNode as Element) || p; // 確保 ancestor 沒有 span 元素
308+
p = (p.closest("aside")?.parentNode as Element) || p; // 確保 ancestor 沒有 aside 元素
309+
return p;
306310
}}
307311
>
308312
{contextHolder}

0 commit comments

Comments
 (0)