Skip to content

Commit 6dd59ee

Browse files
committed
fix(v-model): should ignore compiled v-model listeners in attr fallthrough
fix #1510
1 parent 77538ec commit 6dd59ee

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

packages/runtime-core/src/componentProps.ts

+13-8
Original file line numberDiff line numberDiff line change
@@ -190,19 +190,20 @@ export function updateProps(
190190
for (const key in rawCurrentProps) {
191191
if (
192192
!rawProps ||
193-
(
194-
// for camelCase
195-
!hasOwn(rawProps, key) &&
193+
// for camelCase
194+
(!hasOwn(rawProps, key) &&
196195
// it's possible the original props was passed in as kebab-case
197196
// and converted to camelCase (#955)
198197
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))
199198
) {
200199
if (options) {
201-
if (rawPrevProps && (
200+
if (
201+
rawPrevProps &&
202202
// for camelCase
203-
rawPrevProps[key] !== undefined ||
204-
// for kebab-case
205-
rawPrevProps[kebabKey!] !== undefined)) {
203+
(rawPrevProps[key] !== undefined ||
204+
// for kebab-case
205+
rawPrevProps[kebabKey!] !== undefined)
206+
) {
206207
props[key] = resolvePropValue(
207208
options,
208209
rawProps || EMPTY_OBJ,
@@ -255,7 +256,11 @@ function setFullProps(
255256
let camelKey
256257
if (options && hasOwn(options, (camelKey = camelize(key)))) {
257258
props[camelKey] = value
258-
} else if (!emits || !isEmitListener(emits, key)) {
259+
} else if (
260+
(!emits || !isEmitListener(emits, key)) &&
261+
// ignore v-model listeners
262+
!key.startsWith(`onUpdate:`)
263+
) {
259264
// Any non-declared (either as a prop or an emitted event) props are put
260265
// into a separate `attrs` object for spreading. Make sure to preserve
261266
// original key casing

0 commit comments

Comments
 (0)