vue.js:634 [Vue warn]: Error compiling template:
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.
<input type="text" class="form-control" v-model="user">
</div>
<div class="form-group">
<label for="">评论内容:</label>
<textarea class="form-control" v-model="content"></textarea>
</div>
<div class="form-group">
<input type="button" value="发表评论" class="btn btn-primary" @click="postComment">
</div>
found in <CmtBox’> <'Root>
突然看到这么一大块错误代码着实有点吃惊,但错误信息的最前面就表明了‘Component template should contain exactly one root element’,翻译过来就是组件模板应该只包含一个根元素,回去看了下源码后发现template标签下有多个div元素同级并列,在template下插入一个div作为唯一根元素,把之前模板里的代码都放入新建的div中错误就解决了