mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-24 07:29:16 +08:00
fix(Tabs): can not render line when wrapper is fixed (#5496)
This commit is contained in:
parent
31c94472b1
commit
c89d5ee096
@ -1,5 +1,11 @@
|
||||
export function isHidden(element: HTMLElement) {
|
||||
return (
|
||||
window.getComputedStyle(element).display === 'none' || element.offsetParent === null
|
||||
);
|
||||
const style = window.getComputedStyle(element);
|
||||
const isHidden = style.display === 'none';
|
||||
|
||||
// offsetParent returns null in the following situations:
|
||||
// 1. The element or its parent element has the display property set to none.
|
||||
// 2. The element has the position property set to fixed
|
||||
const isParentHidden = element.offsetParent === null && style.position !== 'fixed';
|
||||
|
||||
return isHidden || isParentHidden;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user