Skip to content

Commit

Permalink
fix(compat): avoid accidentally delete the modelValue prop (#3772)
Browse files Browse the repository at this point in the history
  • Loading branch information
HcySunYang authored May 17, 2021
1 parent 92e7330 commit 4f17be7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/runtime-core/src/compat/componentVModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ export function convertLegacyVModelProps(vnode: VNode) {
// modelValue -> value
// onUpdate:modelValue -> onModelCompat:input
const { prop = 'value', event = 'input' } = (type as any).model || {}
props[prop] = props.modelValue
delete props.modelValue
if (prop !== 'modelValue') {
props[prop] = props.modelValue
delete props.modelValue
}
// important: update dynamic props
if (dynamicProps) {
dynamicProps[dynamicProps.indexOf('modelValue')] = prop
Expand Down

0 comments on commit 4f17be7

Please sign in to comment.