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

@@ -8,6 +8,7 @@ import {
VNode
} from '../vnode'
import { PatchFlags } from '@vue/shared'
import { warn } from '../warning'
export function renderSlot(
slots: Record<string, Slot>,
@@ -17,7 +18,17 @@ export function renderSlot(
// the compiler and guaranteed to be an array
fallback?: VNodeArrayChildren
): VNode {
const slot = slots[name]
let slot = slots[name]
if (__DEV__ && slot.length > 1) {
warn(
`SSR-optimized slot function detected in a non-SSR-optimized render ` +
`function. You need to mark this component with $dynamic-slots in the ` +
`parent template.`
)
slot = () => []
}
return (
openBlock(),
createBlock(