The template root requires exactly one elementvuevalid-template-root
This error message is related to Vue.js templates and indicates that the root element of the template should have only one element.
In a Vue.js template, there should always be a single root element that contains all the other elements. This root element is usually a div or a template tag. If there is more than one root element, Vue.js will throw an error with the message "template root requires exactly one element".
To fix this error, make sure that your template has only one root element. This can be achieved by wrapping all your elements inside a single parent element. For example:
<template>
<div>
<h1>Hello World</h1>
<p>This is a paragraph.</p>
</div>
</template>
In this example, the div element is the root element that contains the h1 and p elements. This template has only one root element and will not cause the "template root requires exactly one element" error.
原文地址: https://www.cveoy.top/t/topic/bnRU 著作权归作者所有。请勿转载和采集!