1

是否允许在模板中使用类似这样的模板标签。我必须检查一些值。

<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>

我在我的项目中使用这个系统只是想知道它是否正确?

4

1 回答 1

1

尝试使用这个。<template>只需要一个孩子。

<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>
于 2019-12-06T09:09:33.283 回答