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
, or missing. Bailing hydration and performing full client-side render.
nuxt.js报错
-
[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.
-
[Vue警告]:客户端呈现的虚拟DOM树与服务器呈现的内容不匹配。这可能是由错误的HTML标记引起的,例如在<p>中嵌套块级元素,或缺少<tbody>。
解决
- 官方解决方案
- Nuxt 版本小于 v2.9.0 的用户, 请使用
<no-ssr>
,大于v2.9.0的使用<client-only>
- 相关文档:no-ssr client-only
- 组件逐个渲染排查,最后发现是在
span
元素中间加了注释,去掉注释之后成功解决。