From: HcySunYang Date: Mon, 17 May 2021 18:07:53 +0000 (+0800) Subject: fix(compat): avoid accidentally delete the modelValue prop (#3772) X-Git-Tag: v3.1.0-beta.4~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f17be7b1ce4872ded085a36b95c1897d8c1f299;p=thirdparty%2Fvuejs%2Fcore.git fix(compat): avoid accidentally delete the modelValue prop (#3772) --- diff --git a/packages/runtime-core/src/compat/componentVModel.ts b/packages/runtime-core/src/compat/componentVModel.ts index 03ae787afb..e179c3b1d4 100644 --- a/packages/runtime-core/src/compat/componentVModel.ts +++ b/packages/runtime-core/src/compat/componentVModel.ts @@ -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