nuxt报错:[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 warn]:客户端呈现的虚拟DOM树与服务器呈现的内容不匹配。这可能是由于不正确的HTML标记造成的,例如在< p>中嵌套块级元素,或者缺少< tbody>
报错原因:服务端与客户端渲染的DOM结构不一样。
搜索到一个解决方案
解决方案:在该element-ui组件最外层加上
<client-only>
组件,该组件只是占位且用于仅在客户端渲染其他组件
加上<client-only>
后,成功解决报错~