wangxinhui
2026-03-26 5c272c606bdf2da3577dbaa5f48d0ee163f1e7d2
1
2
3
4
5
6
7
8
import validation from './test.js';
 
// 添加单位,如果有rpx,%,px等单位结尾或者值为auto,直接返回,否则加上rpx单位结尾
export default function addUnit(value = 'auto', unit = 'rpx') {
    value = String(value);
    // 用uView内置验证规则中的number判断是否为数值
    return validation.number(value) ? `${value}${unit}` : value;
}