Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 87x 87x 87x 5x 5x 2x 2x 3x 7x 3x | import { toHandlerKey, isObject } from '@vue/shared' import { warn } from '../warning' /** * For prefixing keys in v-on="obj" with "on" * @private */ export function toHandlers( obj: Record<string, any>, preserveCaseIfNecessary?: boolean ): Record<string, any> { const ret: Record<string, any> = {} if (__DEV__ && !isObject(obj)) { warn(`v-on with no argument expects an object value.`) return ret } for (const key in obj) { ret[ preserveCaseIfNecessary && /[A-Z]/.test(key) ? `on:${key}` : toHandlerKey(key) ] = obj[key] } return ret } |