Vue单文件组件提示错误:Component template
2020-07-15 本文已影响0人
TOPro
错误原因
-
写了多个root节点,这个情况很常见
-
第二种原因就奇葩一些,root元素使用html保留的关键字。比如 frame。解决方法就是避开html关键字,或者改为大写
Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instea
![](https://img.haomeiwen.com/i1912618/53c69c82dfa4c84c.png)