UNPKG

element-plus

Version:
72 lines (66 loc) 2.03 kB
import { defineComponent, openBlock, createElementBlock, normalizeClass, createCommentVNode, renderSlot } from 'vue'; var script = defineComponent({ name: "ElLink", props: { type: { type: String, default: "default", validator: (val) => { return ["default", "primary", "success", "warning", "info", "danger"].includes(val); } }, underline: { type: Boolean, default: true }, disabled: { type: Boolean, default: false }, href: { type: String, default: "" }, icon: { type: String, default: "" } }, emits: ["click"], setup(props, { emit }) { function handleClick(event) { if (!props.disabled) { emit("click", event); } } return { handleClick }; } }); const _hoisted_1 = ["href"]; const _hoisted_2 = { key: 1, class: "el-link--inner" }; function render(_ctx, _cache, $props, $setup, $data, $options) { return openBlock(), createElementBlock("a", { class: normalizeClass([ "el-link", _ctx.type ? `el-link--${_ctx.type}` : "", _ctx.disabled && "is-disabled", _ctx.underline && !_ctx.disabled && "is-underline" ]), href: _ctx.disabled || !_ctx.href ? null : _ctx.href, onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)) }, [ _ctx.icon ? (openBlock(), createElementBlock("i", { key: 0, class: normalizeClass(_ctx.icon) }, null, 2)) : createCommentVNode("v-if", true), _ctx.$slots.default ? (openBlock(), createElementBlock("span", _hoisted_2, [ renderSlot(_ctx.$slots, "default") ])) : createCommentVNode("v-if", true), _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 2 }) : createCommentVNode("v-if", true) ], 10, _hoisted_1); } script.render = render; script.__file = "packages/components/link/src/index.vue"; script.install = (app) => { app.component(script.name, script); }; const _Link = script; const ElLink = _Link; export default _Link; export { ElLink };