Skip to content

Commit

Permalink
fix(v-model): should ignore compiled v-model listeners in attr fallth…
Browse files Browse the repository at this point in the history
…rough

fix #1510
  • Loading branch information
yyx990803 committed Jul 6, 2020
1 parent 77538ec commit 6dd59ee
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/runtime-core/src/componentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,20 @@ export function updateProps(
for (const key in rawCurrentProps) {
if (
!rawProps ||
(
// for camelCase
!hasOwn(rawProps, key) &&
// for camelCase
(!hasOwn(rawProps, key) &&
// it's possible the original props was passed in as kebab-case
// and converted to camelCase (#955)
((kebabKey = hyphenate(key)) === key || !hasOwn(rawProps, kebabKey)))
) {
if (options) {
if (rawPrevProps && (
if (
rawPrevProps &&
// for camelCase
rawPrevProps[key] !== undefined ||
// for kebab-case
rawPrevProps[kebabKey!] !== undefined)) {
(rawPrevProps[key] !== undefined ||
// for kebab-case
rawPrevProps[kebabKey!] !== undefined)
) {
props[key] = resolvePropValue(
options,
rawProps || EMPTY_OBJ,
Expand Down Expand Up @@ -255,7 +256,11 @@ function setFullProps(
let camelKey
if (options && hasOwn(options, (camelKey = camelize(key)))) {
props[camelKey] = value
} else if (!emits || !isEmitListener(emits, key)) {
} else if (
(!emits || !isEmitListener(emits, key)) &&
// ignore v-model listeners
!key.startsWith(`onUpdate:`)
) {
// Any non-declared (either as a prop or an emitted event) props are put
// into a separate `attrs` object for spreading. Make sure to preserve
// original key casing
Expand Down

0 comments on commit 6dd59ee

Please sign in to comment.