feat(runtime-dom): defineCustomElement

This commit is contained in:
Evan You
2021-07-12 15:32:38 -04:00
parent 42ace9577d
commit 8610e1c9e2
8 changed files with 546 additions and 14 deletions

View File

@@ -1,6 +1,9 @@
import { Data } from '../component'
import { Slots, RawSlots } from '../componentSlots'
import { ContextualRenderFn } from '../componentRenderContext'
import {
ContextualRenderFn,
currentRenderingInstance
} from '../componentRenderContext'
import { Comment, isVNode } from '../vnode'
import {
VNodeArrayChildren,
@@ -11,6 +14,7 @@ import {
} from '../vnode'
import { PatchFlags, SlotFlags } from '@vue/shared'
import { warn } from '../warning'
import { createVNode } from '@vue/runtime-core'
/**
* Compiler runtime helper for rendering `<slot/>`
@@ -25,6 +29,14 @@ export function renderSlot(
fallback?: () => VNodeArrayChildren,
noSlotted?: boolean
): VNode {
if (currentRenderingInstance!.isCE) {
return createVNode(
'slot',
name === 'default' ? null : { name },
fallback && fallback()
)
}
let slot = slots[name]
if (__DEV__ && slot && slot.length > 1) {