UNPKG

tk-eui-plus

Version:

91 lines (90 loc) 2.33 kB
import { defineComponent as y, useSlots as f, computed as g, openBlock as n, createElementBlock as s, createElementVNode as u, normalizeStyle as d, unref as l, renderSlot as k, toDisplayString as m, createBlock as a, resolveDynamicComponent as i } from "vue"; const p = (t) => t.replace(/(A-Z)g/, "-$1"), x = { class: "trend" }, S = { key: 1 }, C = { class: "icon" }, v = /* @__PURE__ */ y({ __name: "index", props: { //标记趋势是上升up还是下降down type: { type: String, default: "up" }, //趋势显示的文字 text: { type: String, default: "文字" }, //上升趋势图标 upIcon: { type: String, default: "ArrowUp" }, //下降趋势图标 downIcon: { type: String, default: "ArrowDown" }, //上升趋势图标颜色 upIconColor: { type: String, default: "#f5222d" }, //下降趋势图标颜色 downIconColor: { type: String, default: "#52c41a" }, //上升趋势文字颜色 upTextColor: { type: String, default: "rgb(0,0,0)" }, //下降趋势文字颜色 downTextColor: { type: String, default: "rgb(0,0,0)" } }, setup(t) { let e = t, o = f(), r = g(() => e.type === "up" ? e.upTextColor : e.downTextColor); return (c, T) => (n(), s("div", x, [ u( "div", { class: "text", style: d({ color: l(r) }) }, [ l(o).default ? k(c.$slots, "default", { key: 0 }, void 0, !0) : (n(), s( "div", S, m(t.text), 1 /* TEXT */ )) ], 4 /* STYLE */ ), u("div", C, [ t.type === "up" ? (n(), a(i(`tk-icon-${l(p)(t.upIcon)}`), { key: 0, style: d({ color: t.upIconColor }) }, null, 8, ["style"])) : (n(), a(i(`tk-icon-${l(p)(t.downIcon)}`), { key: 1, style: d({ color: t.downIconColor }) }, null, 8, ["style"])) ]) ])); } }), w = (t, e) => { const o = t.__vccOpts || t; for (const [r, c] of e) o[r] = c; return o; }, I = /* @__PURE__ */ w(v, [["__scopeId", "data-v-e2248978"]]), h = { install(t) { t.component("tkTrend", I); } }; export { h as default };