[Vuejs]-Vue.js: Why does $el return a text node

0👍

The solution is as follows.

wrong

<template>
  <div></div>
  <div>
    ...
  </div>
</template>

correct

<template>
  <div>
   <div>...</div>
    ...
  </div>
</template>

OR

wrong

<template>
  <div></div>
  <div>
    ...
  </div>
</template>

correct

<template>
  <div>
   <div>...</div>
    </router-view>
  </div>
</template>

If you do not use a "div" tag just inside the "Template" tag, you will get the same problem.

Leave a comment