feat(compile-core): handle falsy dynamic args for v-on and v-bind (#2393)
fix #2388
This commit is contained in:
@@ -94,7 +94,8 @@ export const isIntegerKey = (key: unknown) =>
|
||||
'' + parseInt(key, 10) === key
|
||||
|
||||
export const isReservedProp = /*#__PURE__*/ makeMap(
|
||||
'key,ref,' +
|
||||
// the leading comma is intentional so empty string "" is also included
|
||||
',key,ref,' +
|
||||
'onVnodeBeforeMount,onVnodeMounted,' +
|
||||
'onVnodeBeforeUpdate,onVnodeUpdated,' +
|
||||
'onVnodeBeforeUnmount,onVnodeUnmounted'
|
||||
@@ -122,19 +123,22 @@ const hyphenateRE = /\B([A-Z])/g
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const hyphenate = cacheStringFunction(
|
||||
(str: string): string => {
|
||||
return str.replace(hyphenateRE, '-$1').toLowerCase()
|
||||
}
|
||||
export const hyphenate = cacheStringFunction((str: string) =>
|
||||
str.replace(hyphenateRE, '-$1').toLowerCase()
|
||||
)
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const capitalize = cacheStringFunction(
|
||||
(str: string): string => {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||
}
|
||||
(str: string) => str.charAt(0).toUpperCase() + str.slice(1)
|
||||
)
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const toHandlerKey = cacheStringFunction(
|
||||
(str: string) => (str ? `on${capitalize(str)}` : ``)
|
||||
)
|
||||
|
||||
// compare whether a value has changed, accounting for NaN.
|
||||
|
||||
Reference in New Issue
Block a user