Skip to content

Commit 96b9744

Browse files
committed
refactor: tweak
1 parent f3fe012 commit 96b9744

File tree

1 file changed

+3
-2
lines changed
  • src/platforms/web/compiler/modules

1 file changed

+3
-2
lines changed

Diff for: src/platforms/web/compiler/modules/model.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ function preTransformNode (el: ASTElement, options: CompilerOptions) {
2828
if (map['v-model'] && (map['v-bind:type'] || map[':type'])) {
2929
const typeBinding: any = getBindingAttr(el, 'type')
3030
const ifCondition = getAndRemoveAttr(el, 'v-if', true)
31+
const ifConditionExtra = ifCondition ? `&&(${ifCondition})` : ``
3132
// 1. checkbox
3233
const branch0 = cloneASTElement(el)
3334
// process for on the main node
3435
processFor(branch0)
3536
addRawAttr(branch0, 'type', 'checkbox')
3637
processElement(branch0, options)
3738
branch0.processed = true // prevent it from double-processed
38-
branch0.if = `type==='checkbox'` + (ifCondition ? `&&(${ifCondition})` : ``)
39+
branch0.if = `type==='checkbox'` + ifConditionExtra
3940
addIfCondition(branch0, {
4041
exp: branch0.if,
4142
block: branch0
@@ -46,7 +47,7 @@ function preTransformNode (el: ASTElement, options: CompilerOptions) {
4647
addRawAttr(branch1, 'type', 'radio')
4748
processElement(branch1, options)
4849
addIfCondition(branch0, {
49-
exp: `type==='radio'` + (ifCondition ? `&&(${ifCondition})` : ``),
50+
exp: `type==='radio'` + ifConditionExtra,
5051
block: branch1
5152
})
5253
// 3. other

0 commit comments

Comments
 (0)