icon2.mjs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { defineComponent, computed, openBlock, createElementBlock, mergeProps, unref, renderSlot } from 'vue';
  2. import '../../../utils/index.mjs';
  3. import '../../../hooks/index.mjs';
  4. import { iconProps } from './icon.mjs';
  5. import _export_sfc from '../../../_virtual/plugin-vue_export-helper.mjs';
  6. import { useNamespace } from '../../../hooks/use-namespace/index.mjs';
  7. import { isUndefined } from '../../../utils/types.mjs';
  8. import { addUnit } from '../../../utils/dom/style.mjs';
  9. const __default__ = defineComponent({
  10. name: "ElIcon",
  11. inheritAttrs: false
  12. });
  13. const _sfc_main = /* @__PURE__ */ defineComponent({
  14. ...__default__,
  15. props: iconProps,
  16. setup(__props) {
  17. const props = __props;
  18. const ns = useNamespace("icon");
  19. const style = computed(() => {
  20. const { size, color } = props;
  21. if (!size && !color)
  22. return {};
  23. return {
  24. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  25. "--color": color
  26. };
  27. });
  28. return (_ctx, _cache) => {
  29. return openBlock(), createElementBlock("i", mergeProps({
  30. class: unref(ns).b(),
  31. style: unref(style)
  32. }, _ctx.$attrs), [
  33. renderSlot(_ctx.$slots, "default")
  34. ], 16);
  35. };
  36. }
  37. });
  38. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  39. export { Icon as default };
  40. //# sourceMappingURL=icon2.mjs.map