Skip to content

Commit

Permalink
fix: 修复指令unbind时存在的空指针问题 (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasonZheng authored Dec 23, 2023
1 parent a57c51b commit f81e47f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f81e47f

Please sign in to comment.