Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked fromvuejs/vue

Commita6169d1

Browse files
privatenumberyyx990803
authored andcommitted
fix(model): fix static input type being overwritten by v-bind object (vuejs#7819)
fixvuejs#7811
1 parent6dd73e9 commita6169d1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

‎src/platforms/web/compiler/modules/model.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function preTransformNode (el: ASTElement, options: CompilerOptions) {
3434
if(map[':type']||map['v-bind:type']){
3535
typeBinding=getBindingAttr(el,'type')
3636
}
37-
if(!typeBinding&&map['v-bind']){
37+
if(!map.type&&!typeBinding&&map['v-bind']){
3838
typeBinding=`(${map['v-bind']}).type`
3939
}
4040

‎test/unit/features/directives/model-checkbox.spec.js‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,15 @@ describe('Directive v-model checkbox', () => {
337337
expect(vm.$el.children[1].textContent).toBe('false')
338338
}).then(done)
339339
})
340+
341+
// #7811
342+
it('type should not be overwritten by v-bind',()=>{
343+
constvm=newVue({
344+
data:{
345+
test:true
346+
},
347+
template:'<input type="checkbox" v-model="test" v-bind="$attrs">'
348+
}).$mount()
349+
expect(vm.$el.type).toBe('checkbox')
350+
})
340351
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp