mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
fix(model): fix static input type being overwritten by v-bind object (#7819)
fix #7811
This commit is contained in:
parent
6dd73e9ee4
commit
a6169d1eb7
@ -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`
|
||||
}
|
||||
|
||||
|
@ -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: '<input type="checkbox" v-model="test" v-bind="$attrs">'
|
||||
}).$mount()
|
||||
expect(vm.$el.type).toBe('checkbox')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user