-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test($compile): #7048 warn if both v-model and v-bind:value used on same element #7056
Changes from 1 commit
f53e523
38981c1
2cab21e
caf15c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -598,6 +598,15 @@ function makeAttrsMap (attrs: Array<Object>): Object { | |
} | ||
map[attrs[i].name] = attrs[i].value | ||
} | ||
if ( | ||
process.env.NODE_ENV !== 'production' && | ||
map['v-model'] && | ||
(map['v-bind:value'] || map[':value']) && | ||
(!map['type'] || map['type'] === 'text') | ||
) { | ||
var vBind = map['v-bind:value'] ? 'v-bind:value' : ':value' | ||
warn('v-model and ' + vBind + ' used on the same text input') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could definitely use a more detailed message here - something like "v-bind:value conflicts with v-model on the same element because the latter already expands to a value binding internally" |
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Check looks good now - but I'm not sure if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, it's now been moved |
||
return map | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warning should apply to anything that is not: