preTransformNode() — vue Function Reference
Architecture documentation for the preTransformNode() function in model.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb["preTransformNode()"] 0d1a9a6d_9f27_26ff_a82e_63f0ab50e4ee["getBindingAttr()"] d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb -->|calls| 0d1a9a6d_9f27_26ff_a82e_63f0ab50e4ee b701a596_9c82_7ec4_2fc8_2e36d33c4974["getAndRemoveAttr()"] d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb -->|calls| b701a596_9c82_7ec4_2fc8_2e36d33c4974 b66fe03d_55e6_8df2_7bba_6549eca8bd96["cloneASTElement()"] d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb -->|calls| b66fe03d_55e6_8df2_7bba_6549eca8bd96 bcf17edf_0894_6bd4_2cdd_7673387d389e["processFor()"] d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb -->|calls| bcf17edf_0894_6bd4_2cdd_7673387d389e a2955388_4c3f_d572_3f8f_be0d96c39ed4["addRawAttr()"] d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb -->|calls| a2955388_4c3f_d572_3f8f_be0d96c39ed4 02a69150_0003_c070_7030_ea511121f64b["processElement()"] d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb -->|calls| 02a69150_0003_c070_7030_ea511121f64b 06e12792_ae17_ac23_460b_7d8d7b5605d2["addIfCondition()"] d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb -->|calls| 06e12792_ae17_ac23_460b_7d8d7b5605d2 style d35ad88b_7ad0_eb3d_d87a_8f404b67b1fb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/platforms/web/compiler/modules/model.ts lines 21–81
function preTransformNode(el: ASTElement, options: CompilerOptions) {
if (el.tag === 'input') {
const map = el.attrsMap
if (!map['v-model']) {
return
}
let typeBinding
if (map[':type'] || map['v-bind:type']) {
typeBinding = getBindingAttr(el, 'type')
}
if (!map.type && !typeBinding && map['v-bind']) {
typeBinding = `(${map['v-bind']}).type`
}
if (typeBinding) {
const ifCondition = getAndRemoveAttr(el, 'v-if', true)
const ifConditionExtra = ifCondition ? `&&(${ifCondition})` : ``
const hasElse = getAndRemoveAttr(el, 'v-else', true) != null
const elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true)
// 1. checkbox
const branch0 = cloneASTElement(el)
// process for on the main node
processFor(branch0)
addRawAttr(branch0, 'type', 'checkbox')
processElement(branch0, options)
branch0.processed = true // prevent it from double-processed
branch0.if = `(${typeBinding})==='checkbox'` + ifConditionExtra
addIfCondition(branch0, {
exp: branch0.if,
block: branch0
})
// 2. add radio else-if condition
const branch1 = cloneASTElement(el)
getAndRemoveAttr(branch1, 'v-for', true)
addRawAttr(branch1, 'type', 'radio')
processElement(branch1, options)
addIfCondition(branch0, {
exp: `(${typeBinding})==='radio'` + ifConditionExtra,
block: branch1
})
// 3. other
const branch2 = cloneASTElement(el)
getAndRemoveAttr(branch2, 'v-for', true)
addRawAttr(branch2, ':type', typeBinding)
processElement(branch2, options)
addIfCondition(branch0, {
exp: ifCondition!,
block: branch2
})
if (hasElse) {
branch0.else = true
} else if (elseIfCondition) {
branch0.elseif = elseIfCondition
}
return branch0
}
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does preTransformNode() do?
preTransformNode() is a function in the vue codebase.
What does preTransformNode() call?
preTransformNode() calls 7 function(s): addIfCondition, addRawAttr, cloneASTElement, getAndRemoveAttr, getBindingAttr, processElement, processFor.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free