LEARNING BY VUEING

Template tag
29 / 42

We looked at v-if before, but you might have noticed that if we use <div v-if="..."> only as a wrapper for the condition, it creates unnecessary tags in the final HTML. In this example, it even breaks the CSS.

To create an "invisible" node that will only exist in the template, you can use the template tag.

Try replacing the <div> with a <template> to fix the broken CSS.

The same trick works with v-for.