mirror of https://github.com/vuejs/core.git
Merge 495da080bc
into 56be3dd4db
This commit is contained in:
commit
5073d1c873
|
@ -1229,5 +1229,16 @@ function testRender(type: string, render: typeof renderToString) {
|
||||||
// during the render phase
|
// during the render phase
|
||||||
expect(getterSpy).toHaveBeenCalledTimes(2)
|
expect(getterSpy).toHaveBeenCalledTimes(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('manually using the h function (return a HTMLElement)', async () => {
|
||||||
|
const MyNode = h('div', { id: 'aaaa' })
|
||||||
|
const app = createSSRApp({
|
||||||
|
ssrRender(_ctx, push, parent) {
|
||||||
|
push(ssrRenderComponent(MyNode, null, null, parent))
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const html = await render(app)
|
||||||
|
expect(html).toBe(`<div id="aaaa"></div>`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,13 @@ export function renderComponentVNode(
|
||||||
parentComponent: ComponentInternalInstance | null = null,
|
parentComponent: ComponentInternalInstance | null = null,
|
||||||
slotScopeId?: string,
|
slotScopeId?: string,
|
||||||
): SSRBuffer | Promise<SSRBuffer> {
|
): SSRBuffer | Promise<SSRBuffer> {
|
||||||
|
// vnode may be an ELEMENT
|
||||||
|
if (vnode.shapeFlag & ShapeFlags.ELEMENT) {
|
||||||
|
const { getBuffer, push } = createBuffer()
|
||||||
|
renderElementVNode(push, vnode, parentComponent!, slotScopeId)
|
||||||
|
return getBuffer()
|
||||||
|
}
|
||||||
|
|
||||||
const instance = (vnode.component = createComponentInstance(
|
const instance = (vnode.component = createComponentInstance(
|
||||||
vnode,
|
vnode,
|
||||||
parentComponent,
|
parentComponent,
|
||||||
|
|
Loading…
Reference in New Issue