diff --git a/src/platforms/web/compiler/directives/model.js b/src/platforms/web/compiler/directives/model.js index 2533ba3560f..fc33a0c6e45 100644 --- a/src/platforms/web/compiler/directives/model.js +++ b/src/platforms/web/compiler/directives/model.js @@ -130,9 +130,11 @@ function genDefaultModel ( const type = el.attrsMap.type // warn if v-bind:value conflicts with v-model + // except for inputs with v-bind:type if (process.env.NODE_ENV !== 'production') { const value = el.attrsMap['v-bind:value'] || el.attrsMap[':value'] - if (value) { + const typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'] + if (value && !typeBinding) { const binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value' warn( `${binding}="${value}" conflicts with v-model on the same element ` + diff --git a/test/unit/features/directives/model-text.spec.js b/test/unit/features/directives/model-text.spec.js index 7aae24b654e..7b6fa9fe28b 100644 --- a/test/unit/features/directives/model-text.spec.js +++ b/test/unit/features/directives/model-text.spec.js @@ -291,6 +291,17 @@ describe('Directive v-model text', () => { expect('conflicts with v-model').not.toHaveBeenWarned() }) + it('should not warn on input with dynamic type binding', () => { + new Vue({ + data: { + type: 'checkbox', + test: 'foo' + }, + template: '' + }).$mount() + expect('conflicts with v-model').not.toHaveBeenWarned() + }) + if (!isAndroid) { it('does not trigger extra input events with single compositionend', () => { const spy = jasmine.createSpy()