UNPKG

@arco-design/web-vue

Version:

Arco Design Vue 2.0: A Vue.js 3 UI Library

10 lines (9 loc) 366 B
import NP from "number-precision"; const getOffsetPercent = (value, [min, max]) => { const percent = Math.max((value - min) / (max - min), 0); return `${NP.round(percent * 100, 2)}%`; }; const getPositionStyle = (offset, direction) => { return direction === "vertical" ? { bottom: offset } : { left: offset }; }; export { getOffsetPercent, getPositionStyle };