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模板只能有一个跟对象

我是这样写的

最后修改为

就可以正常运行了

原文地址:https://www.cnblogs.com/mxyr/p/10282180.html