mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
types(utils): isHidden ref param maybe undefined
This commit is contained in:
parent
14d2826cc7
commit
bfdc6f6b4e
@ -1,7 +1,13 @@
|
|||||||
import { unref, Ref } from 'vue';
|
import { unref, Ref } from 'vue';
|
||||||
|
|
||||||
export function isHidden(elementRef: HTMLElement | Ref<HTMLElement>) {
|
export function isHidden(
|
||||||
|
elementRef: HTMLElement | Ref<HTMLElement | undefined>
|
||||||
|
) {
|
||||||
const el = unref(elementRef);
|
const el = unref(elementRef);
|
||||||
|
if (!el) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const style = window.getComputedStyle(el);
|
const style = window.getComputedStyle(el);
|
||||||
const hidden = style.display === 'none';
|
const hidden = style.display === 'none';
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user