fix(compat): avoid accidentally delete the modelValue prop (#3772)

This commit is contained in:
HcySunYang 2021-05-18 02:07:53 +08:00 committed by GitHub
parent 92e7330385
commit 4f17be7b1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,8 +39,10 @@ export function convertLegacyVModelProps(vnode: VNode) {
// modelValue -> value // modelValue -> value
// onUpdate:modelValue -> onModelCompat:input // onUpdate:modelValue -> onModelCompat:input
const { prop = 'value', event = 'input' } = (type as any).model || {} const { prop = 'value', event = 'input' } = (type as any).model || {}
props[prop] = props.modelValue if (prop !== 'modelValue') {
delete props.modelValue props[prop] = props.modelValue
delete props.modelValue
}
// important: update dynamic props // important: update dynamic props
if (dynamicProps) { if (dynamicProps) {
dynamicProps[dynamicProps.indexOf('modelValue')] = prop dynamicProps[dynamicProps.indexOf('modelValue')] = prop