UNPKG

hu-element-components

Version:

90 lines (89 loc) 2.54 kB
import { defineComponent as f, useSlots as C, computed as w, createElementBlock as a, openBlock as r, createElementVNode as s, normalizeStyle as d, unref as l, createCommentVNode as u, renderSlot as v, toDisplayString as m, createBlock as i, resolveDynamicComponent as p } from "vue"; const y = (e) => e.replace(/(A-Z)g/, "-$1").toLocaleLowerCase(), g = { class: "trend" }, x = { key: 1 }, S = { class: "icon" }, I = /* @__PURE__ */ f({ __name: "index", props: { type: { type: String, default: "up" }, upIcon: { type: String, default: "ArrowUp" }, downIcon: { type: String, default: "ArrowDown" }, text: { type: String, default: "文字" }, reverseColor: { type: Boolean, default: !1 }, 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(e) { let o = e, t = C(), n = w(() => o.type === "up" ? o.upTextColor : o.downTextColor); return (c, B) => (r(), a("div", g, [ s( "div", { class: "text", style: d({ color: l(n) }) }, [ u(" {{ textColor }} "), l(t).default ? v(c.$slots, "default", { key: 0 }, void 0, !0) : (r(), a( "div", x, m(e.text), 1 /* TEXT */ )) ], 4 /* STYLE */ ), s("div", S, [ u(` <el-icon-arrowup :style="{color: !reverseColor ? upIconColor : '#52c41a'}" v-if="type === 'up'"></el-icon-arrowup>\r <el-icon-arrowdown :style="{color: !reverseColor ? downIconColor : '#f5222d'}" v-else></el-icon-arrowdown> `), e.type === "up" ? (r(), i(p(`el-icon-${l(y)(e.upIcon)}`), { key: 0, style: d({ color: e.reverseColor ? "#52c41a" : e.upIconColor }) }, null, 8, ["style"])) : (r(), i(p(`el-icon-${l(y)(e.downIcon)}`), { key: 1, style: d({ color: e.reverseColor ? "#f5222d" : e.downIconColor }) }, null, 8, ["style"])) ]) ])); } }), k = (e, o) => { const t = e.__vccOpts || e; for (const [n, c] of o) t[n] = c; return t; }, h = /* @__PURE__ */ k(I, [["__scopeId", "data-v-974d944c"]]), $ = { install(e) { e.component("m-trend", h); } }; export { $ as default };