A umi plugin,根据 umi4 创建的单位转换工具;
目的是统一项目涉及到的前端单位转换
前提条件:项目必须升级到 umi4.
将会持续收集需要转换的公式(convert-units 中没有的)
pnpm i @zhangjindong/plugin-convert-units
Configure in .umirc.ts
,
export default {
plugins: [["@zhangjindong/plugin-convert-units"]],
pluginConvertUnits: ["area", "length", "mass", "pressure", "speed", "volume"],
};
Configure in .umirc.ts
,
export default {
plugins: [["@biomind/plugin-convert-units"]],
pluginConvertUnits: ["area", "length", "mass", "pressure", "speed", "volume"],
};
import { convert } from "umi";
const value = convert(4).from("m").to("cm");
MIT