hongluan-ui
Version:
Hongluan Component Library for Vue 3
45 lines (42 loc) • 1.72 kB
JavaScript
import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, renderSlot, createCommentVNode } from 'vue';
import '../../../hooks/index.mjs';
import { linkProps, linkEmits } from './link.mjs';
import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
const __default__ = defineComponent({
name: "Link"
});
const _sfc_main = /* @__PURE__ */ defineComponent({
...__default__,
props: linkProps,
emits: linkEmits,
setup(__props, { emit }) {
const props = __props;
const { namespace } = useNamespace("link");
function handleClick(event) {
if (!props.disabled)
emit("click", event);
}
return (_ctx, _cache) => {
return openBlock(), createElementBlock("a", {
class: normalizeClass({
[unref(namespace)]: true,
"is-underline": _ctx.underline === true && !_ctx.disabled,
"is-hover-underline": _ctx.underline === "hover" && !_ctx.disabled,
"is-disabled": _ctx.disabled,
[_ctx.type]: true
}),
target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
onClick: handleClick
}, [
_ctx.$slots.prefix ? renderSlot(_ctx.$slots, "prefix", { key: 0 }) : createCommentVNode("v-if", true),
_ctx.$slots.default ? (openBlock(), createElementBlock("span", { key: 1 }, [
renderSlot(_ctx.$slots, "default")
])) : createCommentVNode("v-if", true),
_ctx.$slots.suffix ? renderSlot(_ctx.$slots, "suffix", { key: 2 }) : createCommentVNode("v-if", true)
], 10, ["target", "href"]);
};
}
});
export { _sfc_main as default };
//# sourceMappingURL=link2.mjs.map