mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-03 19:58:09 +08:00
17 lines
417 B
TypeScript
17 lines
417 B
TypeScript
import { isNumber } from '@element-plus/utils/util'
|
|
|
|
export const isValidWidthUnit = (val: string | number): boolean =>{
|
|
if(isNumber(val)){
|
|
return true
|
|
} else {
|
|
return ['px', 'rem', 'em', 'vw', '%', 'vmin', 'vmax'].some(unit =>
|
|
(val as string).endsWith(unit),
|
|
)
|
|
}
|
|
return false
|
|
}
|
|
|
|
|
|
export const isValidComponentSize = (val: string) =>
|
|
['', 'large', 'medium', 'small', 'mini'].includes(val)
|