tav-ui
Version:
53 lines (50 loc) • 1.57 kB
JavaScript
import { defineComponent, computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode } from 'vue';
import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
const _sfc_main = defineComponent({
name: "SvgIcon",
props: {
prefix: {
type: String,
default: "icon"
},
name: {
type: String,
required: true
},
size: {
type: [Number, String],
default: 16
},
spin: {
type: Boolean,
default: false
}
},
setup(props) {
const prefixCls = "ta-icon-svg";
const symbolId = computed(() => `#${props.prefix}-${props.name}`);
const getStyle = computed(() => {
const { size } = props;
let s = `${size}`;
s = `${s.replace("px", "")}px`;
return {
width: s,
height: s
};
});
return { symbolId, prefixCls, getStyle };
}
});
const _hoisted_1 = ["xlink:href"];
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return openBlock(), createElementBlock("svg", {
class: normalizeClass([_ctx.prefixCls, _ctx.$attrs.class, _ctx.spin && "svg-icon-spin"]),
style: normalizeStyle(_ctx.getStyle),
"aria-hidden": "true"
}, [
createElementVNode("use", { "xlink:href": _ctx.symbolId }, null, 8, _hoisted_1)
], 6);
}
var IconSvg = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/tav-ui/tav-ui/packages/components/icon-svg/src/icon-svg.vue"]]);
export { IconSvg as default };
//# sourceMappingURL=icon-svg2.mjs.map