feat: createApp / appContext

This commit is contained in:
Evan You
2019-09-02 16:09:34 -04:00
parent aac807bc63
commit 32713f8fce
8 changed files with 226 additions and 9 deletions

View File

@@ -12,6 +12,7 @@ import { RawSlots } from './componentSlots'
import { PatchFlags } from './patchFlags'
import { ShapeFlags } from './shapeFlags'
import { isReactive } from '@vue/reactivity'
import { AppContext } from './apiCreateApp'
export const Fragment = Symbol('Fragment')
export const Text = Symbol('Text')
@@ -50,6 +51,9 @@ export interface VNode {
patchFlag: number
dynamicProps: string[] | null
dynamicChildren: VNode[] | null
// application root node only
appContext: AppContext | null
}
// Since v-if and v-for are the two possible ways node structure can dynamically
@@ -152,7 +156,8 @@ export function createVNode(
shapeFlag,
patchFlag,
dynamicProps,
dynamicChildren: null
dynamicChildren: null,
appContext: null
}
normalizeChildren(vnode, children)
@@ -192,6 +197,7 @@ export function cloneVNode(vnode: VNode): VNode {
patchFlag: vnode.patchFlag,
dynamicProps: vnode.dynamicProps,
dynamicChildren: vnode.dynamicChildren,
appContext: vnode.appContext,
// these should be set to null since they should only be present on
// mounted VNodes. If they are somehow not null, this means we have