perf: improve directive runtime performance

This commit is contained in:
Evan You
2019-10-26 16:00:07 -04:00
parent 6c7787db7b
commit 07ce2c5fa7
3 changed files with 86 additions and 66 deletions

View File

@@ -17,6 +17,7 @@ import { ShapeFlags } from './shapeFlags'
import { isReactive } from '@vue/reactivity'
import { AppContext } from './apiApp'
import { SuspenseBoundary } from './suspense'
import { DirectiveBinding } from './directives'
export const Fragment = Symbol(__DEV__ ? 'Fragment' : undefined)
export const Portal = Symbol(__DEV__ ? 'Portal' : undefined)
@@ -66,6 +67,7 @@ export interface VNode<HostNode = any, HostElement = any> {
children: NormalizedChildren<HostNode, HostElement>
component: ComponentInternalInstance | null
suspense: SuspenseBoundary<HostNode, HostElement> | null
dirs: DirectiveBinding[] | null
// DOM
el: HostNode | null
@@ -200,6 +202,7 @@ export function createVNode(
children: null,
component: null,
suspense: null,
dirs: null,
el: null,
anchor: null,
target: null,
@@ -247,6 +250,7 @@ export function cloneVNode(vnode: VNode, extraProps?: Data): VNode {
dynamicProps: vnode.dynamicProps,
dynamicChildren: vnode.dynamicChildren,
appContext: vnode.appContext,
dirs: vnode.dirs,
// 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