'Does Vuejs allow to use nested template tag?

Is it allowed to use <template> tag inside template something like this. I have to check some value.

<template>
    <div>
        <template v-for="category_field in category_fields">
            <template v-if="category_field.show_type == 'new-row'">
                //and also here can be more nested template tags
            </template>
            <template v-else>
                //and also here can be more nested template tags
            </template>
        </template>
    </div>
</template>

I am using this system in my project just wondering is it correct way?



Solution 1:[1]

Try using this. <template> require only one child.

<template v-for="category_field in category_fields">
<div>
    <template v-if="category_field.show_type == 'new-row'">
        //and also here can be more nested template tags
    </template>
    <template v-else>
        //and also here can be more nested template tags
    </template>
</div>
</template>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 stchr