wip: refs

This commit is contained in:
Evan You
2019-06-03 13:44:45 +08:00
parent 0ad31f29c4
commit 2848f65a7f
6 changed files with 69 additions and 14 deletions

View File

@@ -35,6 +35,7 @@ export interface VNode {
type: VNodeTypes
props: { [key: string]: any } | null
key: string | number | null
ref: string | Function | null
children: NormalizedChildren
component: ComponentInstance | null
@@ -65,6 +66,9 @@ const blockStack: (VNode[] | null)[] = []
// function render() {
// return (openBlock(),createBlock('div', null, [...]))
// }
//
// disableTracking is true when creating a fragment block, since a fragment
// always diffs its children.
export function openBlock(disableTrackng?: boolean) {
blockStack.push(disableTrackng ? null : [])
}
@@ -116,6 +120,7 @@ export function createVNode(
type,
props,
key: props && props.key,
ref: props && props.ref,
children: null,
component: null,
el: null,