In Vue 2 it was not allowed to have more than one root node inside a template.
So this was allowed:
<template>
<div> <!--- this is a root node -->
<p>This is content</p>
<p>This is more content</p>
</div>
</template>
But this is not allowed:
<template>
<div> <!--- this is a root node -->
<p>This is content</p>
<p>This is more content</p>
</div>
<div> <!-- error: this is a second root node -->
<p> .... </p>
</div>
</template>
You get a white screen and bells and whistles will go off in Developer Console if you do that.
There was one exception though for root nodes that have v-if, v-else, v-else-if. The reasoning behind this is that, after evaluating these if statements there will be one only node that is mounted. This may be confusing to new users.
So, to make it clear, this is allowed:
<template>
<div v-if="someExpression">
<p>Case 1</p>
</div>
<div v-else-if="somethingElse">
<p>Some other case</p>
</div>
<div v-else>
<p>Else case</p>
</div>
</template>
Vue 3 does allow muliple root nodes, so maybe your eslint rules are still vue 2 rules. Either way. For Vue it was recommended to always wrap the entire thing in tags just to be sure.
Multiple root node errors are often caused by forgetting to properly close html tags, or use the wrong ones.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…