@opensig/opendesign
Version:
<p align="center"><img src="../docs/public/opendesign-logo-light.png"/></p> <h1 align="center">opendesign</h1> <p align="center">一个 Vue 3 组件库</p> <p align="center"><b>皮肤可定制,使用 TypeScript</b></p>
84 lines (83 loc) • 3.01 kB
JavaScript
"use strict";
const vue = require("vue");
require("../config-provider/index.js");
const global = require("../_utils/global.js");
const icons = require("../_utils/icons.js");
const htmlTag = require("../_components/html-tag.js");
const types = require("./types.js");
const provide = require("../config-provider/provide.js");
const _hoisted_1 = {
key: 0,
class: "o-link-prefix"
};
const _hoisted_2 = { class: "o-link-main" };
const _hoisted_3 = {
key: 0,
class: "o-link-label"
};
const _hoisted_4 = {
key: 1,
class: "o-link-suffix"
};
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
__name: "OLink",
props: types.linkProps,
emits: ["click"],
setup(__props, { emit: __emit }) {
const props = __props;
const configProvider = vue.inject(provide.configProviderInjectKey, {});
const $attr = vue.useAttrs();
const emits = __emit;
const onClick = (e) => {
var _a;
if (props.disabled || props.loading) {
e.preventDefault();
return;
}
emits("click", e);
if (props.global) {
(_a = configProvider.link) == null ? void 0 : _a.click(e, props, $attr);
}
};
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(vue.unref(htmlTag), vue.mergeProps({
tag: props.tag,
class: ["o-link", [
{
"o-link-disabled": props.disabled,
"o-link-hover-bg": props.hoverBg,
"o-link-hover-underline": props.hoverUnderline
},
`o-link-${props.color}`,
`o-link-${props.size || vue.unref(global.defaultSize)}`
]],
href: props.href,
target: props.target
}, _ctx.$attrs, { onClick }), {
default: vue.withCtx(() => [
_ctx.$slots.icon || props.icon || props.loading ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1, [
props.loading ? (vue.openBlock(), vue.createBlock(vue.unref(icons.IconLoading), {
key: 0,
class: "o-rotating"
})) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 }, () => [
(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(props.icon)))
])
])) : vue.createCommentVNode("v-if", true),
vue.createElementVNode("span", _hoisted_2, [
props.hoverUnderline ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
vue.renderSlot(_ctx.$slots, "default")
])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
]),
_ctx.$slots.suffix || props.suffix ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4, [
vue.renderSlot(_ctx.$slots, "suffix", {}, () => [
vue.createVNode(vue.unref(icons.IconLinkArrow), { class: "o-link-icon-arrow" })
])
])) : vue.createCommentVNode("v-if", true)
]),
_: 3
/* FORWARDED */
}, 16, ["tag", "href", "target", "class"]);
};
}
});
module.exports = _sfc_main;