vue中Component错误

报错:Component you should use exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

翻译:组件应该只使用一个根元素。 如果您在多个元素上使用v-if,请使用v-else-if来链接它们。

原因:组件中<template></template>标签内缺少根元素

解决:添加根元素<div></div>
<template>
    <div>
        内容
    </div>
</template>

猜你喜欢

转载自www.cnblogs.com/luowenshuai/p/9392699.html