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.

[Vue warn]: Error compiling template:

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.

 

 

先来看看引起Error模版的写法:

 

引起这个错误,是模版只能有一个Root节点存在。在template内,添加一个唯一节点来包含所有内容,即可以解决:

 

posted @ 2021-02-23 07:03  Insus.NET  阅读(400)  评论(0编辑  收藏  举报