feat(compiler/slot): bail out of optimization mode for non-compiled slots

This commit is contained in:
Evan You
2019-10-03 15:09:09 -04:00
parent 05db2a9c6c
commit 227ad034f0
4 changed files with 23 additions and 10 deletions

View File

@@ -6,22 +6,24 @@ import {
Fragment,
VNode
} from '../vnode'
import { PatchFlags } from '@vue/shared'
export function renderSlot(
slots: Record<string, Slot>,
key: string,
name: string,
props: any = {},
// this is not a user-facing function, so the fallback is always generated by
// the compiler and gurunteed to be an array
fallback?: VNodeChildren
): VNode {
const slot = slots[key]
const slot = slots[name]
return (
openBlock(),
createBlock(
Fragment,
{ key: props.key },
slot ? slot(props) : fallback || []
slot ? slot(props) : fallback || [],
slots._compiled ? 0 : PatchFlags.BAIL
)
)
}