fix: value does not exist, warning appears (#5906)

This commit is contained in:
啝裳 2022-02-10 23:29:04 +08:00 committed by GitHub
parent bbe1cdcb13
commit 81bca48fd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,11 +4,11 @@ import { debugWarn } from '../error'
const SCOPE = 'utils-v2/vue/style'
export function addUnit(value: string | number, defaultUnit = 'px') {
if (!value) return ''
if (isString(value)) {
return value
} else if (isNumber(value)) {
return `${value}${defaultUnit}`
}
debugWarn(SCOPE, 'binding value must be a string or number')
return ''
}