UNPKG

@gyenno/nutui-taro

Version:

京东风格的轻量级移动端 Vue2、Vue3 组件库(支持小程序开发)

48 lines (47 loc) 1.49 kB
import { defineComponent, useSlots, useAttrs, h, openBlock, createBlock } from "vue"; const N = /* @__PURE__ */ defineComponent({ __name: "IconFont", props: { name: { type: String, default: "" }, size: { type: [String, Number], default: "" }, width: { type: [String, Number], default: "" }, height: { type: [String, Number], default: "" }, classPrefix: { type: String, default: "nut-icon" }, fontClassName: { type: String, default: "nutui-iconfont" }, color: { type: String, default: "" }, tag: { type: String, default: "i" } }, emits: ["click"], setup(n, { emit: i }) { var a; const t = n, c = "nut-icon", l = (e) => { i("click", e); }, o = useSlots(); useAttrs(); const u = () => t.name ? t.name.indexOf("/") !== -1 : false, r = (e) => { if (e) return isNaN(Number(e)) ? String(e) : e + "px"; }, s = u(); let m = h( s ? "img" : t.tag, { class: s ? `${c}__img` : `${t.fontClassName} ${c} ${t.classPrefix}-${t.name}`, style: { color: t.color, fontSize: r(t.size), width: r(t.width || t.size), height: r(t.height || t.size) }, onClick: l, src: s ? t.name : "" }, (a = o.default) == null ? void 0 : a.call(o) ); const f = () => m; return (e, x) => (openBlock(), createBlock(f)); } }), _ = (n) => (n.install = (i) => { i.component("IconFont", n); }, n); _(N); const style_icon = "";