Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
你需要设置一个根元素。
解决方案1:
template="<div>原有内容</div>"
或者你别的什么标签也罢。
解决方案2:
在你引用的内容上加上字符串格式的标签符号。
本文介绍了如何解决Vue组件模板中必须包含唯一根元素的问题。提供了两种解决方案:一是为组件内容包裹一个根标签;二是对引用内容使用字符串格式的标签符号。
Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
你需要设置一个根元素。
解决方案1:
template="<div>原有内容</div>"
或者你别的什么标签也罢。
解决方案2:
在你引用的内容上加上字符串格式的标签符号。
991
2万+
1297

被折叠的 条评论
为什么被折叠?