タイトル: Emitted value instead of an instance of Error
SEOタイトル: 【Vue.jsエラー】Emitted value instead of an instance of Error
| この記事の要点 |
|---|
|
エラー内容
|
(Emitted value instead of an instance of Error) ... - 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. |
発生条件/原因/対処法
<template>直下に複数タグがあると発生するエラー。(root elementは一つでなくてはならない)
以下、エラー例。
|
<template> <p>aaa</p> <p>bbb</p> </template> |
<template>直下に<p>が二つあるのでエラー。
以下の様に、ルートエレメントは一つでなくてはならない。
|
<template> <div> <p>aaa</p> <p>bbb</p> </div> </template> |