LoginSignup
3
0

More than 5 years have passed since last update.

[Nuxt.js] Mismatching childNodes vs. VNodes

Posted at

状況

  • Consoleに以下エラーが出た。

vue.js-20190315-20190324-104100.png

Mismatching childNodes vs. VNodes:  
:
[Vue warn]: The client-side rendered virtual DOM tree is not matching server-rendered content. This is likely caused by incorrect HTML markup, for example nesting block-level elements inside <p>, or missing <tbody>. Bailing hydration and performing full client-side render.

原因、対策

  • p の中に div とかネスト構造がHTML規約に準じていない時に発生するようだが、今回の場合、HTMLのコメント表記が悪さしてたようだ。

  • エラーになる例

<template>
    :
    <!-- comment -->
    xxx
    :
</template>
  • エラーにならない例
    • pタグで囲っただけ
<template>
    :
    <!-- comment -->
    <p>xxx</p>
    :
</template>
3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0