diff --git a/src/platforms/web/compiler/modules/model.js b/src/platforms/web/compiler/modules/model.js index a7426c020..8d784fe46 100644 --- a/src/platforms/web/compiler/modules/model.js +++ b/src/platforms/web/compiler/modules/model.js @@ -34,7 +34,7 @@ function preTransformNode (el: ASTElement, options: CompilerOptions) { if (map[':type'] || map['v-bind:type']) { typeBinding = getBindingAttr(el, 'type') } - if (!typeBinding && map['v-bind']) { + if (!map.type && !typeBinding && map['v-bind']) { typeBinding = `(${map['v-bind']}).type` } diff --git a/test/unit/features/directives/model-checkbox.spec.js b/test/unit/features/directives/model-checkbox.spec.js index e102af626..2b73e23d3 100644 --- a/test/unit/features/directives/model-checkbox.spec.js +++ b/test/unit/features/directives/model-checkbox.spec.js @@ -337,4 +337,15 @@ describe('Directive v-model checkbox', () => { expect(vm.$el.children[1].textContent).toBe('false') }).then(done) }) + + // #7811 + it('type should not be overwritten by v-bind', () => { + const vm = new Vue({ + data: { + test: true + }, + template: '' + }).$mount() + expect(vm.$el.type).toBe('checkbox') + }) })