layui/package/component/es/dropdownMenuItem/index2.js

52 lines
1.8 KiB
JavaScript
Raw Normal View History

2022-11-15 01:16:55 +00:00
import { w as withInstall } from "../badge/index2.js";
import { defineComponent, inject, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, createCommentVNode } from "vue";
import { d as dropdownInjectionKey } from "../dropdown/index2.js";
const _hoisted_1 = { class: "layui-menu-body-title" };
const _hoisted_2 = {
key: 0,
class: "layui-dropdown-menu-prefix"
};
const _hoisted_3 = {
key: 0,
class: "layui-dropdown-menu-suffix"
};
const __default__ = {
name: "LayDropdownMenuItem"
};
const _sfc_main = defineComponent({
...__default__,
props: {
disabled: { type: Boolean, default: false }
},
setup(__props) {
const props = __props;
inject("openState");
const dropdownCtx = inject(dropdownInjectionKey, void 0);
const handleClick = () => {
if (props.disabled) {
return;
}
dropdownCtx == null ? void 0 : dropdownCtx.hide();
};
return (_ctx, _cache) => {
return openBlock(), createElementBlock("li", {
onClick: handleClick,
class: normalizeClass({ "layui-disabled": __props.disabled }),
style: normalizeStyle(_ctx.$slots.suffix ? `justify-content: space-between;` : "")
}, [
createElementVNode("span", _hoisted_1, [
_ctx.$slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_2, [
renderSlot(_ctx.$slots, "prefix")
])) : createCommentVNode("", true),
renderSlot(_ctx.$slots, "default")
]),
_ctx.$slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_3, [
renderSlot(_ctx.$slots, "suffix")
])) : createCommentVNode("", true)
], 6);
};
}
});
const component = withInstall(_sfc_main);
export { _sfc_main as _, component as c };