genIfConditions() — vue Function Reference
Architecture documentation for the genIfConditions() function in index.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 016cc772_3198_eb71_716e_46e8192d13cc["genIfConditions()"] 54260741_ae9d_a025_86de_47c513f5f82d["index.ts"] 016cc772_3198_eb71_716e_46e8192d13cc -->|defined in| 54260741_ae9d_a025_86de_47c513f5f82d e9890815_0d7c_a227_7123_bb7fe2649918["genIf()"] e9890815_0d7c_a227_7123_bb7fe2649918 -->|calls| 016cc772_3198_eb71_716e_46e8192d13cc e6ae3747_8265_7dc5_77d6_fef4ab96c493["genOnce()"] 016cc772_3198_eb71_716e_46e8192d13cc -->|calls| e6ae3747_8265_7dc5_77d6_fef4ab96c493 075d1f95_9965_89f4_3c01_f944fee6b553["genElement()"] 016cc772_3198_eb71_716e_46e8192d13cc -->|calls| 075d1f95_9965_89f4_3c01_f944fee6b553 style 016cc772_3198_eb71_716e_46e8192d13cc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/compiler/codegen/index.ts lines 212–239
function genIfConditions(
conditions: ASTIfConditions,
state: CodegenState,
altGen?: Function,
altEmpty?: string
): string {
if (!conditions.length) {
return altEmpty || '_e()'
}
const condition = conditions.shift()!
if (condition.exp) {
return `(${condition.exp})?${genTernaryExp(
condition.block
)}:${genIfConditions(conditions, state, altGen, altEmpty)}`
} else {
return `${genTernaryExp(condition.block)}`
}
// v-if with v-once should generate code like (a)?_m(0):_m(1)
function genTernaryExp(el) {
return altGen
? altGen(el, state)
: el.once
? genOnce(el, state)
: genElement(el, state)
}
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does genIfConditions() do?
genIfConditions() is a function in the vue codebase, defined in src/compiler/codegen/index.ts.
Where is genIfConditions() defined?
genIfConditions() is defined in src/compiler/codegen/index.ts at line 212.
What does genIfConditions() call?
genIfConditions() calls 2 function(s): genElement, genOnce.
What calls genIfConditions()?
genIfConditions() is called by 1 function(s): genIf.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free