Match-id-b5f917c72588dc46381019cba0455e0369de6e5b

This commit is contained in:
* 2022-02-17 14:58:30 +08:00 committed by *
parent 832a5b51c2
commit 74c1452b07
3 changed files with 26 additions and 18 deletions

View File

@ -30,10 +30,18 @@ let ctxOldChange: Boolean = false;
let ctxOldPreviousContext: Object = {};
function setContext(vNode: VNode, contextName, value) {
if (vNode.contexts === null) {
vNode.contexts = {
[contextName]: value,
};
} else {
vNode.contexts[contextName] = value;
}
}
function getContext(vNode: VNode, contextName) {
if (vNode.contexts !== null) {
return vNode.contexts[contextName];
}
}
// capture阶段设置

View File

@ -1,5 +1,5 @@
import type {VNode} from '../Types';
import type {Props} from '../../dom/DOMOperator';
import type { VNode } from '../Types';
import type { Props } from '../../dom/DOMOperator';
import {
getNamespaceCtx,
@ -12,10 +12,10 @@ import {
initDomProps, getPropChangeList,
isTextChild,
} from '../../dom/DOMOperator';
import {FlagUtils} from '../vnode/VNodeFlags';
import {createVNodeChildren, markRef} from './BaseComponent';
import {DomComponent, DomPortal, DomText} from '../vnode/VNodeTags';
import {getFirstChild, travelVNodeTree} from '../vnode/VNodeUtils';
import { FlagUtils } from '../vnode/VNodeFlags';
import { createVNodeChildren, markRef } from './BaseComponent';
import { DomComponent, DomPortal, DomText } from '../vnode/VNodeTags';
import { travelVNodeTree } from '../vnode/VNodeUtils';
function updateDom(
processing: VNode,

View File

@ -42,7 +42,7 @@ export class VNode {
task: any;
// 使用这个变量来记录修改前的值,用于恢复。
contexts = {};
contexts: any = null;
// 因为LazyComponent会修改tag和type属性为了能识别增加一个属性
isLazyComponent: boolean = false;