UNPKG

mine-h5-ui

Version:

一款轻量级、模块化基于 Vue3.x 的 H5 前端 UI 组件库 👍

38 lines (37 loc) 1.03 kB
import { watch as h, computed as $ } from "vue"; /*! * mine-h5-ui v2.16.0 * Copyright (c) 2025 biaov * @license MIT */ const s = (i, n) => { const c = (t) => { t < i.min && (t = i.min), t > i.max && (t = i.max), n.value = t; }; h( n, (t) => { t && (n.value = (`${t}`.includes(".") ? parseFloat(`${t}`) : parseInt(`${t}`)) || "", c(+n.value)); }, { immediate: !0 } ); const d = () => { !n.value && (n.value = i.min); }, e = (t) => { if (i.disabled) return; const b = +(+n.value + t).toFixed(`${t}`.split(".")[1]?.length ?? 0); c(b); }, r = (t) => `${Number(t)}` == `${t}` ? `${t}px` : t, o = $(() => ({ height: r(i.height), "--input-width": r(i.inputWidth), "--color": i.color, "--border-color": i.borderColor, "--border-radius": r(i.borderRadius), "--disabled-color": i.disabledColor, "--font-size": r(i.fontSize) })); return { onClickBtn: e, onBlur: d, getStyle: o }; }; export { s as useHandle };