Skip to content

addUnit

给一个值添加单位

引入

js
import { addUnit } from '@/uni_modules/lime-shared/addUnit'

示例

js
addUnit(100) // 输出: "100px"
addUnit("200") // 输出: "200px"
addUnit("300px") // 输出: "300px"(已经包含单位)
addUnit() // 输出: undefined(值为 undefined)
addUnit(null) // 输出: undefined(值为 null)