From bfdc6f6b4e5f394b13933b49ee539ea7a59db1de Mon Sep 17 00:00:00 2001
From: chenjiahan <chenjiahan@youzan.com>
Date: Fri, 9 Oct 2020 20:33:41 +0800
Subject: [PATCH] types(utils): isHidden ref param maybe undefined

---
 src/utils/dom/style.ts | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/utils/dom/style.ts b/src/utils/dom/style.ts
index e5f9b0ac2..0c180497d 100644
--- a/src/utils/dom/style.ts
+++ b/src/utils/dom/style.ts
@@ -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';