mirror of
https://github.com/youzan/vant.git
synced 2026-01-20 07:00:14 +08:00
types(utils): isHidden ref param maybe undefined
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { unref, Ref } from 'vue';
|
||||
|
||||
export function isHidden(elementRef: HTMLElement | Ref<HTMLElement>) {
|
||||
export function isHidden(
|
||||
elementRef: HTMLElement | Ref<HTMLElement | undefined>
|
||||
) {
|
||||
const el = unref(elementRef);
|
||||
if (!el) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const style = window.getComputedStyle(el);
|
||||
const hidden = style.display === 'none';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user