错误【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.
直译出来 就是:组件模板应该包含一个根元素。如果在多个元素上使用V-IF,则使用V-ELS-IF来链接它们。
其实就是该处只能有一个根元素,如果存在多个就会报错。
解决办法就是用一个根元素将所有的元素都包起来。