),
).toBe(`<div style="color:red;font-size:12;display:none;"></div>`)
})
+
+ test('with component', async () => {
+ expect(
+ await renderToString(
+ createApp({
+ components: {
+ Foo: {
+ template: `<div><span v-bind="$attrs"></span></div>`,
+ },
+ },
+ data: () => ({ show: false }),
+ template: `<Foo v-show="show"/>`,
+ }),
+ ),
+ ).toBe(`<div style="display:none;"><span></span></div>`)
+ })
+
+ test('with dynamic component', async () => {
+ expect(
+ await renderToString(
+ createApp({
+ components: {
+ Foo: {
+ template: `<div><span v-bind="$attrs"></span></div>`,
+ },
+ },
+ data: () => ({ show: false }),
+ template: `<component is="Foo" v-show="show"/>`,
+ }),
+ ),
+ ).toBe(`<div style="display:none;"><span></span></div>`)
+ })
})
describe('template v-model', () => {
children: Slots | SSRSlots | null = null,
parentComponent: ComponentInternalInstance | null = null,
slotScopeId?: string,
+ vShowValue?: Props,
): SSRBuffer | Promise<SSRBuffer> {
return renderComponentVNode(
createVNode(comp, props, children),
parentComponent,
slotScopeId,
+ vShowValue,
)
}
vnode: VNode,
parentComponent: ComponentInternalInstance | null = null,
slotScopeId?: string,
- vShowValue?: Props | null,
+ vShowValue?: Props,
): SSRBuffer | Promise<SSRBuffer> {
const instance = (vnode.component = createComponentInstance(
vnode,
function renderComponentSubTree(
instance: ComponentInternalInstance,
slotScopeId?: string,
- vShowValue?: Props | null,
+ vShowValue?: Props,
): SSRBuffer | Promise<SSRBuffer> {
if (__DEV__) pushWarningContext(instance.vnode)
const comp = instance.type as Component
vnode: VNode,
parentComponent: ComponentInternalInstance,
slotScopeId?: string,
- vShowValue?: Props | null,
+ vShowValue?: Props,
): void {
const { type, shapeFlag, children, dirs, props } = vnode
if (dirs) {