Vue Error: text XXX outside root element will be ignored.

created at 07-07-2021 views: 6

descritpion

About Vue error: 

Error: text XXX outside root element will be ignored. Reasons and solutions

reason

<template>
      <h1>Personal display page</h1>
       <h2>Contents</h2>
</template>

In Vue, there can only be one follow tag under a <template> tag, and there can be no high tags at the same time

Solution

<template>
   <div>
     <h1>Personal display page</h1>
     <h2>Contents</h2>
   </div>

</template>

Use one <div> tag to encapsulate multiple tags into one tag

Please log in to leave a comment.