yk-element-components
Version:
77 lines (76 loc) • 2.08 kB
JavaScript
import { defineComponent as p, useSlots as f, computed as C, openBlock as n, createElementBlock as s, createElementVNode as a, normalizeStyle as d, unref as l, renderSlot as g, toDisplayString as v, createBlock as u, resolveDynamicComponent as i } from "vue";
const y = (e) => e.replace(/(A-Z)g/, "-$1").toLocaleLowerCase(), x = { class: "trend" }, m = { key: 1 }, S = { class: "icon" }, w = /* @__PURE__ */ p({
__name: "index",
props: {
type: {
type: String,
default: "up"
},
upIcon: {
type: String,
default: "ArrowUp"
},
downIcon: {
type: String,
default: "ArrowDown"
},
text: {
type: String,
default: ""
},
upIconColor: {
type: String,
default: "#f5222d"
},
downIconColor: {
type: String,
default: "#52c41a"
},
reverseColor: {
type: Boolean,
default: !1
},
upTextColor: {
type: String,
default: "rgb(0,0,0)"
},
downTextColor: {
type: String,
default: "rgb(0,0,0)"
}
},
setup(e) {
const t = e;
let o = f(), r = C(() => t.type === "up" ? t.upTextColor : t.downTextColor);
return (c, I) => (n(), s("div", x, [
a("div", {
class: "text",
style: d({ color: l(r) })
}, [
l(o).default ? g(c.$slots, "default", { key: 0 }, void 0, !0) : (n(), s("div", m, v(e.text), 1))
], 4),
a("div", S, [
e.type === "up" ? (n(), u(i(`el-icon-${l(y)(e.upIcon)}`), {
key: 0,
style: d({ color: e.reverseColor ? "#52c41a" : e.upIconColor })
}, null, 8, ["style"])) : (n(), u(i(`el-icon-${l(y)(e.downIcon)}`), {
key: 1,
style: d({ color: e.reverseColor ? "#f5222d" : e.downIconColor })
}, null, 8, ["style"]))
])
]));
}
});
const _ = (e, t) => {
const o = e.__vccOpts || e;
for (const [r, c] of t)
o[r] = c;
return o;
}, k = /* @__PURE__ */ _(w, [["__scopeId", "data-v-a794dc26"]]), B = {
install(e) {
e.component("yk-trend", k);
}
};
export {
B as default
};