fix(v-on): capitalize dynamic event names
This commit is contained in:
@@ -94,6 +94,9 @@ const cacheStringFunction = <T extends (str: string) => string>(fn: T): T => {
|
||||
}
|
||||
|
||||
const camelizeRE = /-(\w)/g
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const camelize = cacheStringFunction(
|
||||
(str: string): string => {
|
||||
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''))
|
||||
@@ -101,12 +104,18 @@ export const camelize = cacheStringFunction(
|
||||
)
|
||||
|
||||
const hyphenateRE = /\B([A-Z])/g
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const hyphenate = cacheStringFunction(
|
||||
(str: string): string => {
|
||||
return str.replace(hyphenateRE, '-$1').toLowerCase()
|
||||
}
|
||||
)
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
export const capitalize = cacheStringFunction(
|
||||
(str: string): string => {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { isArray, isObject, isPlainObject } from './index'
|
||||
|
||||
// For converting {{ interpolation }} values to displayed strings.
|
||||
/**
|
||||
* For converting {{ interpolation }} values to displayed strings.
|
||||
* @private
|
||||
*/
|
||||
export const toDisplayString = (val: unknown): string => {
|
||||
return val == null
|
||||
? ''
|
||||
|
||||
Reference in New Issue
Block a user