Skip to content

Custom v-if / v-if source code #9452

Oct 21, 2023 · 2 comments · 5 replies
Discussion options

You must be logged in to vote

You don't find it because control flow directives like v-if and v-for are not normal directives with runtime code - they are handled during template copmilation by the compiler and replaced with actual Javascript code.

That is to say: If you want to write a directive that works similar to v-if, you would have to write a vite-plugin or something that extends the Vue compiler to enable that. You can't really implement v-if/else logic with a runtime custom directive.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
4 replies
@john-landgrave
Comment options

@anthonymp13
Comment options

@mitjans
Comment options

@douglasg14b
Comment options

Answer selected by LadIQe
Comment options

You must be logged in to vote
1 reply
@LadIQe
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
7 participants