tass-ui
Version:
A high quality UI Toolkit built on Vue.js3+.
41 lines (40 loc) • 1.21 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: "dropdownMenu",
setup(__props) {
let state = reactive({
showMenu: false
});
onMounted(() => {
mitt.on("updateShowMenu", (isOption) => {
if (typeof isOption === "boolean") {
state.showMenu = isOption;
}
});
mitt.on("mouseleave", (isOption) => {
if (typeof isOption === "boolean") {
state.showMenu = false;
}
});
});
return (_ctx, _cache) => {
return openBlock(), createBlock(Transition, { name: "tas-dropdown-transition" }, {
default: withCtx(() => [
unref(state).showMenu ? (openBlock(), createElementBlock("ul", _hoisted_1, [
renderSlot(_ctx.$slots, "default")
])) : createCommentVNode("", true)
]),
_: 3
});
};
}
});
export {
_sfc_main as default
};