d94928ac33cb4b981197f2ed2c1517ea7be3c7f88dc642f1d34c08243098bce86e95769b1da1a70d9426199034d1fc433bb1a5f85c0c0b600cd61e3a6eb7a9 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var index$2 = require('../../icon/index.js');
  5. var link = require('./link.js');
  6. var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
  7. var useGlobalConfig = require('../../config-provider/src/hooks/use-global-config.js');
  8. var index = require('../../../hooks/use-deprecated/index.js');
  9. var types = require('../../../utils/types.js');
  10. var index$1 = require('../../../hooks/use-namespace/index.js');
  11. const __default__ = vue.defineComponent({
  12. name: "ElLink"
  13. });
  14. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  15. ...__default__,
  16. props: link.linkProps,
  17. emits: link.linkEmits,
  18. setup(__props, { emit }) {
  19. const props = __props;
  20. const globalConfig = useGlobalConfig.useGlobalConfig("link");
  21. index.useDeprecated({
  22. scope: "el-link",
  23. from: "The underline option (boolean)",
  24. replacement: "'always' | 'hover' | 'never'",
  25. version: "3.0.0",
  26. ref: "https://element-plus.org/en-US/component/link.html#underline"
  27. }, vue.computed(() => types.isBoolean(props.underline)));
  28. const ns = index$1.useNamespace("link");
  29. const linkKls = vue.computed(() => {
  30. var _a, _b, _c;
  31. return [
  32. ns.b(),
  33. ns.m((_c = (_b = props.type) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.type) != null ? _c : "default"),
  34. ns.is("disabled", props.disabled),
  35. ns.is("underline", underline.value === "always"),
  36. ns.is("hover-underline", underline.value === "hover" && !props.disabled)
  37. ];
  38. });
  39. const underline = vue.computed(() => {
  40. var _a, _b, _c;
  41. if (types.isBoolean(props.underline)) {
  42. return props.underline ? "hover" : "never";
  43. } else
  44. return (_c = (_b = props.underline) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.underline) != null ? _c : "hover";
  45. });
  46. function handleClick(event) {
  47. if (!props.disabled)
  48. emit("click", event);
  49. }
  50. return (_ctx, _cache) => {
  51. return vue.openBlock(), vue.createElementBlock("a", {
  52. class: vue.normalizeClass(vue.unref(linkKls)),
  53. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  54. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  55. onClick: handleClick
  56. }, [
  57. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.ElIcon), { key: 0 }, {
  58. default: vue.withCtx(() => [
  59. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  60. ]),
  61. _: 1
  62. })) : vue.createCommentVNode("v-if", true),
  63. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  64. key: 1,
  65. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  66. }, [
  67. vue.renderSlot(_ctx.$slots, "default")
  68. ], 2)) : vue.createCommentVNode("v-if", true),
  69. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  70. ], 10, ["href", "target"]);
  71. };
  72. }
  73. });
  74. var Link = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "link.vue"]]);
  75. exports["default"] = Link;
  76. //# sourceMappingURL=link2.js.map