vuux
Version:
Vue3 Nuxt3 Nuxt4 组件库
27 lines (26 loc) • 596 B
JavaScript
import { inject as r, ref as a, computed as l } from "vue";
const f = (e) => {
const n = r("contextMenuContext"), t = a(!1), s = l(() => ({
"is-disabled": e.disabled,
"is-hover": t.value
})), u = (i) => {
i.stopPropagation(), !e.disabled && n?.hide();
};
let o;
return {
isHover: t,
classNames: s,
handleClick: u,
onMouseEnter: () => {
e.disabled || (clearTimeout(o), t.value = !0);
},
onMouseLeave: () => {
e.disabled || (o = window.setTimeout(() => {
t.value = !1;
}, 150));
}
};
};
export {
f as useContextSub
};