fix(Transition): fix validate duration (#1188)
This commit is contained in:
@@ -7,7 +7,7 @@ import {
|
||||
getCurrentInstance,
|
||||
callWithAsyncErrorHandling
|
||||
} from '@vue/runtime-core'
|
||||
import { isObject } from '@vue/shared'
|
||||
import { isObject, toNumber } from '@vue/shared'
|
||||
import { ErrorCodes } from 'packages/runtime-core/src/errorHandling'
|
||||
|
||||
const TRANSITION = 'transition'
|
||||
@@ -165,15 +165,15 @@ function normalizeDuration(
|
||||
if (duration == null) {
|
||||
return null
|
||||
} else if (isObject(duration)) {
|
||||
return [toNumber(duration.enter), toNumber(duration.leave)]
|
||||
return [NumberOf(duration.enter), NumberOf(duration.leave)]
|
||||
} else {
|
||||
const n = toNumber(duration)
|
||||
const n = NumberOf(duration)
|
||||
return [n, n]
|
||||
}
|
||||
}
|
||||
|
||||
function toNumber(val: unknown): number {
|
||||
const res = Number(val || 0)
|
||||
function NumberOf(val: unknown): number {
|
||||
const res = toNumber(val)
|
||||
if (__DEV__) validateDuration(res)
|
||||
return res
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user