UNPKG

uv-ui

Version:

基于vue3的移动端组件库

45 lines (44 loc) 1.05 kB
import { isDef as c, isNumeric as a } from "./type.js"; const f = (t) => (t.install = (n) => { n.component(t.name, t); }, t), u = (t, n, r = 0.3) => { let i = 0; const s = t.scrollLeft, o = r === 0 ? 1 : Math.round(r * 1e3 / 16); function e() { t.scrollLeft += (n - s) / o, ++i < o && requestAnimationFrame(e); } e(); }, l = (t) => { const n = "scrollTop" in t ? t.scrollTop : t.pageYOffset; return Math.max(n, 0); }, p = (t, n, r) => Math.min(Math.max(t, n), r), d = (t) => { if (!t) return 0; const n = t.match(/^\d*(\.\d*)?/); return n ? Number(n[0]) : 0; }, h = (t) => { if (c(t)) return a(t) ? `${t}px` : String(t); }, x = typeof window < "u"; function T(t) { requestAnimationFrame(() => { requestAnimationFrame(t); }); } function A(t, ...n) { if (Array.isArray(t)) return t.map((r) => r(...n)); if (t) return t(...n); } export { h as addUnit, A as call, p as clamp, l as getScrollTop, x as inBrowser, T as nextTickFrame, d as pxToNum, u as scrollLeftTo, f as withInstall };