[compiler] What is IfNode and NodeTypes.IF
#6558
Unanswered
marekvospel
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In the declarations of
@vue/compiler-sfcI've noticed there is a Node calledIfNode, which confused me, as vue uses directives for conditional rendering. (v-if)While exploring the output of
@vue/compiler-sfcI found that indeed,v-ifdirective are directives, and that there is noIfNodein the output ast.Looking trough the code of
@vue/compiler-core, I've found aparseWithIfTransformfunction in the tests, that transforms the ast and addsIfNode. (use)That made me think that
IfNodeis just a testing node, and that it can't be returned by@vue/compiler-coreor@vue/compiler-sfcand others.Is that correct? Or is there a way to enable the
ifTransformor get theIfNodein the parse results?Beta Was this translation helpful? Give feedback.
All reactions