From 1493d74afc04e6442a71f2fd6f7fba59aa565bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Thu, 1 Aug 2024 15:38:26 +0800 Subject: [PATCH] fix: v-hover --- src/cell/cell.tsx | 2 +- src/shared/hover.ts | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/cell/cell.tsx b/src/cell/cell.tsx index 3d9a32fd7..5b9ef3a51 100644 --- a/src/cell/cell.tsx +++ b/src/cell/cell.tsx @@ -84,7 +84,7 @@ export default defineComponent({ const note = readerTNodeContent('default', 'note'); return (
diff --git a/src/shared/hover.ts b/src/shared/hover.ts index 77f063260..4df42d7d5 100644 --- a/src/shared/hover.ts +++ b/src/shared/hover.ts @@ -1,21 +1,20 @@ -import { DirectiveBinding, VNode } from 'vue'; +import { DirectiveBinding } from 'vue'; interface BindingObj { - disabledName: string; + disabledHover: boolean; className: string; } const Hover = { - created(el: HTMLElement, binding: DirectiveBinding, vnode: VNode) { + created(el: HTMLElement, binding: DirectiveBinding) { const startTime = 50; const stayTime = 70; - const { className, disabledName = 'disabled' } = binding.value; + const { className, disabledHover = false } = binding.value; el.addEventListener( 'touchstart', () => { - // @ts-ignore - if (vnode.ctx.ctx[disabledName]) return; + if (disabledHover) return; setTimeout(() => { el?.classList.add(className); @@ -27,8 +26,7 @@ const Hover = { el.addEventListener( 'touchend', () => { - // @ts-ignore - if (vnode.ctx.ctx[disabledName]) return; + if (disabledHover) return; setTimeout(() => { el?.classList.remove(className);