SSR报错[@vue/server-renderer] Invalid VNode type: Symbol(Fragment) (symbol)
当ssr组件中使用v-for的时候会报错,我大概查了下这就是个官方的issue:
https://github.com/vuejs/core/issues/2600
大概意思就是有2个vue,核心报错的源码开发环境下在源码里的:
server-rendr.cjs.js
function renderVNode(push, vnode, parentComponent, slotScopeId) { const { type, shapeFlag, children } = vnode; switch (type) { case vue.Text: push(shared.escapeHtml(children)); break; case vue.Comment: push(children ? `<!--${shared.escapeHtmlComment(children)}-->` : `<!---->`); break; case vue.Static: push(children); break; case vue.Fragment: if (vnode.slotScopeIds) { slotScopeId = (slotScopeId ? slotScopeId + ' ' : '') + vnode.slotScopeIds.join(' '); } push(`<!--[-->`); // open renderVNodeChildren(push, children, parentComponent, slotScopeId); push(`<!--]-->`); // close break; default: if (shapeFlag & 1 /* ELEMENT */) { renderElementVNode(push, vnode, parentComponent, slotScopeId); } else if (shapeFlag & 6 /* COMPONENT */) { push(renderComponentVNode(vnode, parentComponent, slotScopeId)); } else if (shapeFlag & 64 /* TELEPORT */) { renderTeleportVNode(push, vnode, parentComponent, slotScopeId); } else if (shapeFlag & 128 /* SUSPENSE */) { renderVNode(push, vnode.ssContent, parentComponent, slotScopeId); } else { vue.warn('[@vue/server-renderer] Invalid VNode type:', type, `(${typeof type})`); } } }
断点看了下,v-for时的shapeflag为16,这里无法解析
老师也可以帮忙看下一起看下这个问题
25
收起
正在回答 回答被采纳积分+1
1回答
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星