The template root requires exactly one element.(vue/no-multiple-template-root)
时间: 2023-10-23 07:31:12 浏览: 237
This error message typically occurs in Vue.js when you have multiple root elements in your template. In Vue, each component template should have a single root element. To resolve this issue, you can wrap all the elements inside a parent element.
For example, if you have the following code:
```
<template>
<div>
<h1>Title</h1>
<p>Content</p>
</div>
<div>
<button>Submit</button>
</div>
</template>
```
You can fix it by wrapping the elements inside a single parent element like this:
```
<template>
<div>
<div>
<h1>Title</h1>
<p>Content</p>
</div>
<div>
<button>Submit</button>
</div>
</div>
</template>
```
By doing this, you ensure that there is only one root element in the template, which resolves the error.
阅读全文