Component template should contain exactly one root element

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
在这里插入图片描述

报错原因:vue模板只能有一个根节点
解决:给里面的所有代码套一层<div></div>

猜你喜欢

转载自blog.csdn.net/qq_43225030/article/details/85697761