我正在尝试创建 Vue.js 3 SSR 应用程序(包括 ts、@vue/cli、babel)。我使用 Nodejs + Express 作为后端。SSR 工作正常(我从服务器正确渲染了 html),但在客户端水合作用期间发生错误。我的客户端构建似乎不包含组件的模板,因为我在浏览器中收到这些错误
\nVue warn]: Component is missing template or render function. \n at <App> \n at <App>\n\nVue warn]: Hydration node mismatch:\n- Client vnode: Symbol(Comment) \n- Server rendered DOM: <div class=\xe2\x80\x8b"hello-world">\xe2\x80\x8bhello\xe2\x80\x8b</div>\xe2\x80\x8b \n at <App> \n at <App>\n\nruntime-core.cjs.js:2942 Hydration completed but contains mismatches.\nRun Code Online (Sandbox Code Playgroud)\n我发现当我用渲染函数替换模板时错误消失了,但它再次出现在子组件上(为简单起见,HelloWorld没有子组件)。
\n这是我的 github 存储库,我在其中重现了我的问题。
index.html
Vue warn]: Component is missing template or render function. \n at <App> \n at <App>\n\nVue warn]: Hydration node …Run Code Online (Sandbox Code Playgroud)