wip(ssr): ssr slot vnode fallback

This commit is contained in:
Evan You
2020-02-07 01:06:51 -05:00
parent 31f3383a02
commit b7a74d0439
15 changed files with 308 additions and 131 deletions

View File

@@ -57,10 +57,13 @@ describe('ssr: components', () => {
_push(_ssrRenderComponent(_component_foo, null, {
default: (_, _push, _parent, _scopeId) => {
if (_scopeId) {
_push(\`hello<div \${_scopeId}></div>\`)
if (_push) {
_push(\`hello<div\${_scopeId}></div>\`)
} else {
_push(\`hello<div></div>\`)
return [
createTextVNode(\\"hello\\"),
createVNode(\\"div\\")
]
}
},
_compiled: true
@@ -80,7 +83,13 @@ describe('ssr: components', () => {
_push(_ssrRenderComponent(_component_foo, null, {
default: ({ msg }, _push, _parent, _scopeId) => {
_push(\`\${_ssrInterpolate(msg + _ctx.outer)}\`)
if (_push) {
_push(\`\${_ssrInterpolate(msg + _ctx.outer)}\`)
} else {
return [
createTextVNode(toDisplayString(_ctx.msg + _ctx.outer))
]
}
},
_compiled: true
}, _parent))
@@ -103,10 +112,22 @@ describe('ssr: components', () => {
_push(_ssrRenderComponent(_component_foo, null, {
default: (_, _push, _parent, _scopeId) => {
_push(\`foo\`)
if (_push) {
_push(\`foo\`)
} else {
return [
createTextVNode(\\"foo\\")
]
}
},
named: (_, _push, _parent, _scopeId) => {
_push(\`bar\`)
if (_push) {
_push(\`bar\`)
} else {
return [
createTextVNode(\\"bar\\")
]
}
},
_compiled: true
}, _parent))
@@ -131,7 +152,13 @@ describe('ssr: components', () => {
? {
name: \\"named\\",
fn: (_, _push, _parent, _scopeId) => {
_push(\`foo\`)
if (_push) {
_push(\`foo\`)
} else {
return [
createTextVNode(\\"foo\\")
]
}
}
}
: undefined

View File

@@ -31,7 +31,13 @@ describe('ssr: scopeId', () => {
_push(_ssrRenderComponent(_component_foo, null, {
default: (_, _push, _parent, _scopeId) => {
_push(\`foo\`)
if (_push) {
_push(\`foo\`)
} else {
return [
createTextVNode(\\"foo\\")
]
}
},
_compiled: true
}, _parent))
@@ -53,10 +59,12 @@ describe('ssr: scopeId', () => {
_push(_ssrRenderComponent(_component_foo, null, {
default: (_, _push, _parent, _scopeId) => {
if (_scopeId) {
_push(\`<span data-v-xxxxxxx \${_scopeId}>hello</span>\`)
if (_push) {
_push(\`<span data-v-xxxxxxx\${_scopeId}>hello</span>\`)
} else {
_push(\`<span data-v-xxxxxxx>hello</span>\`)
return [
createVNode(\\"span\\", null, \\"hello\\")
]
}
},
_compiled: true
@@ -80,30 +88,30 @@ describe('ssr: scopeId', () => {
_push(_ssrRenderComponent(_component_foo, null, {
default: (_, _push, _parent, _scopeId) => {
if (_scopeId) {
_push(\`<span data-v-xxxxxxx \${_scopeId}>hello</span>\`)
if (_push) {
_push(\`<span data-v-xxxxxxx\${_scopeId}>hello</span>\`)
_push(_ssrRenderComponent(_component_bar, null, {
default: (_, _push, _parent, _scopeId) => {
if (_scopeId) {
_push(\`<span data-v-xxxxxxx \${_scopeId}></span>\`)
if (_push) {
_push(\`<span data-v-xxxxxxx\${_scopeId}></span>\`)
} else {
_push(\`<span data-v-xxxxxxx></span>\`)
return [
createVNode(\\"span\\")
]
}
},
_compiled: true
}, _parent))
} else {
_push(\`<span data-v-xxxxxxx>hello</span>\`)
_push(_ssrRenderComponent(_component_bar, null, {
default: (_, _push, _parent, _scopeId) => {
if (_scopeId) {
_push(\`<span data-v-xxxxxxx \${_scopeId}></span>\`)
} else {
_push(\`<span data-v-xxxxxxx></span>\`)
}
},
_compiled: true
}, _parent))
return [
createVNode(\\"span\\", null, \\"hello\\"),
createVNode(_component_bar, null, {
default: () => [
createVNode(\\"span\\")
],
_compiled: true
})
]
}
},
_compiled: true