@varlet/ui
Version:
A Vue3 component library based on Material Design 2 and 3, supporting mobile and desktop.
9 lines (8 loc) • 314 B
JavaScript
import { convert } from "./convert.mjs";
function toViewport(theme, options = {}) {
const { viewportWidth = 375, viewportUnit = "vmin", unitPrecision = 6 } = options;
return convert(theme, (value) => `${Number((value / viewportWidth * 100).toFixed(unitPrecision))}${viewportUnit}`);
}
export {
toViewport
};