fix(v-model/emit): update:camelCase events should trigger kebab case equivalent
close #656
This commit is contained in:
@@ -25,7 +25,8 @@ import {
|
||||
NO,
|
||||
makeMap,
|
||||
isPromise,
|
||||
isArray
|
||||
isArray,
|
||||
hyphenate
|
||||
} from '@vue/shared'
|
||||
import { SuspenseBoundary } from './components/Suspense'
|
||||
import { CompilerOptions } from '@vue/compiler-core'
|
||||
@@ -221,7 +222,11 @@ export function defineComponentInstance(
|
||||
|
||||
emit: (event, ...args): any[] => {
|
||||
const props = instance.vnode.props || EMPTY_OBJ
|
||||
const handler = props[`on${event}`] || props[`on${capitalize(event)}`]
|
||||
let handler = props[`on${event}`] || props[`on${capitalize(event)}`]
|
||||
if (!handler && event.indexOf('update:') === 0) {
|
||||
event = hyphenate(event)
|
||||
handler = props[`on${event}`] || props[`on${capitalize(event)}`]
|
||||
}
|
||||
if (handler) {
|
||||
const res = callWithAsyncErrorHandling(
|
||||
handler,
|
||||
|
||||
Reference in New Issue
Block a user