From 0e3ad8e12e0b7600fb55de5bfab3efda3012026c Mon Sep 17 00:00:00 2001 From: zcheng Date: Tue, 19 Dec 2023 14:25:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8C=87=E4=BB=A4`unb?= =?UTF-8?q?ind`=E6=97=B6=E5=AD=98=E5=9C=A8=E7=9A=84=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/directive.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/directive.ts b/src/directive.ts index 398eb83..bce6c95 100644 --- a/src/directive.ts +++ b/src/directive.ts @@ -51,6 +51,11 @@ const unbind = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any const contextmenuInstance: any = binding.instance?.$refs[contextmenuKey]; + if (!contextmenuInstance) { + console.error(`没有找到 ${contextmenuKey} 对应的实例`); + return; + } + if (typeof contextmenuInstance.removeReference !== 'function') { console.error(`${contextmenuKey} 对应的实例不是 VContextmenu`); return;