vueのcomponentコンポーネントエラー
772 ワード
エラー: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.
エラーの原因:vueテンプレートは1つの要素のみをサポートし、2つ以上を並列に含めることはできません.ケースにはbuttonとinputの2つの要素があります.
ソリューション:templateのすべてのコンテンツをdivで包み、ルート要素が1つしかないことを実現すれば、解決できます.解決後のコードは次のとおりです.
Vue.component('comment-btn',{
template:``
})
エラーの原因:vueテンプレートは1つの要素のみをサポートし、2つ以上を並列に含めることはできません.ケースにはbuttonとinputの2つの要素があります.
ソリューション:templateのすべてのコンテンツをdivで包み、ルート要素が1つしかないことを実現すれば、解決できます.解決後のコードは次のとおりです.
Vue.component('comment-btn',{
template:``
})