运行代码时,一直报错:

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

我是这样写的

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.

最后修改为

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.

就可以正常运行了

 

相关文章: