You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
309 B
13 lines
309 B
|
3 years ago
|
import isNumber from './isNumber';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @description: 添加单位
|
||
|
|
* @param {String|Number} value ''
|
||
|
|
* @param {String} unit rpx
|
||
|
|
* @return {String}
|
||
|
|
* @example addUnit(30) // 30rpx
|
||
|
|
*/
|
||
|
|
export default function addUnit(value = '', unit = 'rpx') {
|
||
|
|
return isNumber(value) ? Number(value) + unit : value;
|
||
|
|
}
|