8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vue.js, nuxt.jsでtableを使った時の謎のエラーの対処法

Last updated at Posted at 2018-11-05

シンプルなtableを作成するとエラーになる

<table border="1">
  <tr>
    <th>果物</th><th></th>
  </tr>
  <tr>
    <td>イチゴ</td><td>甘い</td>
  </tr>
  <tr>
    <td>レモン</td><td>酸っぱい</td>
  </tr>
</table>

上記のようなtableを作成すると下記のようなエラーが複数でる

error

vue.runtime.esm.js:587 [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.

warning

Mismatching childNodes vs. VNodes:  NodeList [tbody] (3) [VNode, VNode, VNode]
Parent ...

解決策

解決策はシンプル。tbodyを追加する

<table border="1">
  <tbody>
    <tr>
      <th>果物</th><th></th>
    </tr>
    <tr>
      <td>イチゴ</td><td>甘い</td>
    </tr>
    <tr>
      <td>レモン</td><td>酸っぱい</td>
    </tr>
  </tbody>
</table>
8
2
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
8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?