File tree 2 files changed +14
-1
lines changed
src/platforms/web/compiler/directives
test/unit/features/directives
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,11 @@ function genDefaultModel (
130
130
const type = el . attrsMap . type
131
131
132
132
// warn if v-bind:value conflicts with v-model
133
+ // except for inputs with v-bind:type
133
134
if ( process . env . NODE_ENV !== 'production' ) {
134
135
const value = el . attrsMap [ 'v-bind:value' ] || el . attrsMap [ ':value' ]
135
- if ( value ) {
136
+ const typeBinding = el . attrsMap [ 'v-bind:type' ] || el . attrsMap [ ':type' ]
137
+ if ( value && ! typeBinding ) {
136
138
const binding = el . attrsMap [ 'v-bind:value' ] ? 'v-bind:value' : ':value'
137
139
warn (
138
140
`${ binding } ="${ value } " conflicts with v-model on the same element ` +
Original file line number Diff line number Diff line change @@ -289,6 +289,17 @@ describe('Directive v-model text', () => {
289
289
expect ( 'conflicts with v-model' ) . not . toHaveBeenWarned ( )
290
290
} )
291
291
292
+ it ( 'should not warn on input with dynamic type binding' , ( ) => {
293
+ new Vue ( {
294
+ data : {
295
+ type : 'checkbox' ,
296
+ test : 'foo'
297
+ } ,
298
+ template : '<input :type="type" v-model="test" :value="test">'
299
+ } ) . $mount ( )
300
+ expect ( 'conflicts with v-model' ) . not . toHaveBeenWarned ( )
301
+ } )
302
+
292
303
if ( ! isAndroid ) {
293
304
it ( 'does not trigger extra input events with single compositionend' , ( ) => {
294
305
const spy = jasmine . createSpy ( )
You can’t perform that action at this time.
0 commit comments