tass-ui
Version:
A high quality UI Toolkit built on Vue.js3+.
47 lines (46 loc) • 1.36 kB
JavaScript
import { defineComponent, reactive, onMounted, openBlock, createBlock, Transition, withCtx, unref, createElementBlock, renderSlot, createCommentVNode } from "vue";
import "../../../theme-chalk/src/dropdown.scss.mjs";
import mitt from "./event.mjs";
const _hoisted_1 = {
key: 0,
class: "tas-dropdown-menu"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "dropdownMenuClick",
setup(__props) {
let state = reactive({
showMenuClick: false
});
const mouseenter = () => {
state.showMenuClick = true;
};
onMounted(() => {
mitt.on("updateShowMenuClick", (isOption) => {
if (typeof isOption === "boolean") {
state.showMenuClick = isOption;
}
});
mitt.on("mouseleave", (isOption) => {
if (typeof isOption === "boolean") {
state.showMenuClick = isOption;
}
});
});
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, {
name: "tas-dropdown-transition",
onMouseenter: mouseenter
}, {
default: withCtx(() => [
unref(state).showMenuClick ? (openBlock(), createElementBlock("ul", _hoisted_1, [
renderSlot(_ctx.$slots, "default")
])) : createCommentVNode("", true)
]),
_: 3
});
};
}
});
export {
_sfc_main as default
};