UNPKG

@huyuchen/visual

Version:

## 组件环境

76 lines (75 loc) 2.25 kB
import { useCssVars as d, reactive as p, ref as _, watch as N, onMounted as b, toRefs as g, openBlock as s, createElementBlock as n, Fragment as y, renderList as v, unref as h, normalizeClass as k, createElementVNode as x, toDisplayString as I } from "vue"; import "./HuTurnPage.vue2.js"; import R from "../_virtual/_plugin-vue_export-helper.js"; const S = { class: "box-item" }, T = { key: 0 }, A = { key: 1, class: "comma" }, B = { name: "HuTurnPage" }, C = Object.assign(B, { props: { value: { type: Number, // 具体数值 default() { return 0; } }, time: { type: Number, // 滚动要花的时间,单位秒 default() { return 1; } }, color: { type: String, default: "#000" } }, setup(c) { d((r) => ({ "8ee24dd4": c.color })); const a = c, o = p({ orderNum: ["0", "0", ",", "0", "0", "0", ",", "0", "0", "0"], // 默认订单总数 numberItemRef: _(null) }); N( () => a.value, () => { u(a.value), m(); } ), b(() => { u(a.value); }); const u = (r) => { const t = r.toString().split(""), e = t.length; e < 4 || (e < 7 ? t.splice(e - 3, 0, ",") : e < 10 ? (t.splice(e - 3, 0, ","), t.splice(e - 6, 0, ",")) : e < 13 && (t.splice(e - 3, 0, ","), t.splice(e - 6, 0, ","), t.splice(e - 9, 0, ","))), o.orderNum = t; }, m = () => { const r = o.numberItemRef, t = o.orderNum.filter((e) => !isNaN(e)); for (let e = 0; e < r.length; e++) { const l = r[e]; l.style.transform = `translate(-50%, -${t[e] * 10}%)`; } }, { numberItemRef: i, orderNum: f } = g(o); return (r, t) => (s(), n("div", S, [ (s(!0), n(y, null, v(h(f), (e, l) => (s(), n("div", { class: k({ "number-item": !isNaN(e), "mark-item": isNaN(e) }), key: l }, [ isNaN(e) ? (s(), n("span", A, I(e), 1)) : (s(), n("span", T, [ x("i", { ref_for: !0, ref_key: "numberItemRef", ref: i }, "0123456789", 512) ])) ], 2))), 128)) ])); } }), V = /* @__PURE__ */ R(C, [["__scopeId", "data-v-254d9bfa"]]); export { V as default };