Match-id-b5f917c72588dc46381019cba0455e0369de6e5b
This commit is contained in:
parent
832a5b51c2
commit
74c1452b07
|
@ -30,10 +30,18 @@ let ctxOldChange: Boolean = false;
|
||||||
let ctxOldPreviousContext: Object = {};
|
let ctxOldPreviousContext: Object = {};
|
||||||
|
|
||||||
function setContext(vNode: VNode, contextName, value) {
|
function setContext(vNode: VNode, contextName, value) {
|
||||||
|
if (vNode.contexts === null) {
|
||||||
|
vNode.contexts = {
|
||||||
|
[contextName]: value,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
vNode.contexts[contextName] = value;
|
vNode.contexts[contextName] = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function getContext(vNode: VNode, contextName) {
|
function getContext(vNode: VNode, contextName) {
|
||||||
|
if (vNode.contexts !== null) {
|
||||||
return vNode.contexts[contextName];
|
return vNode.contexts[contextName];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// capture阶段设置
|
// capture阶段设置
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type {VNode} from '../Types';
|
import type { VNode } from '../Types';
|
||||||
import type {Props} from '../../dom/DOMOperator';
|
import type { Props } from '../../dom/DOMOperator';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getNamespaceCtx,
|
getNamespaceCtx,
|
||||||
|
@ -12,10 +12,10 @@ import {
|
||||||
initDomProps, getPropChangeList,
|
initDomProps, getPropChangeList,
|
||||||
isTextChild,
|
isTextChild,
|
||||||
} from '../../dom/DOMOperator';
|
} from '../../dom/DOMOperator';
|
||||||
import {FlagUtils} from '../vnode/VNodeFlags';
|
import { FlagUtils } from '../vnode/VNodeFlags';
|
||||||
import {createVNodeChildren, markRef} from './BaseComponent';
|
import { createVNodeChildren, markRef } from './BaseComponent';
|
||||||
import {DomComponent, DomPortal, DomText} from '../vnode/VNodeTags';
|
import { DomComponent, DomPortal, DomText } from '../vnode/VNodeTags';
|
||||||
import {getFirstChild, travelVNodeTree} from '../vnode/VNodeUtils';
|
import { travelVNodeTree } from '../vnode/VNodeUtils';
|
||||||
|
|
||||||
function updateDom(
|
function updateDom(
|
||||||
processing: VNode,
|
processing: VNode,
|
||||||
|
|
|
@ -42,7 +42,7 @@ export class VNode {
|
||||||
task: any;
|
task: any;
|
||||||
|
|
||||||
// 使用这个变量来记录修改前的值,用于恢复。
|
// 使用这个变量来记录修改前的值,用于恢复。
|
||||||
contexts = {};
|
contexts: any = null;
|
||||||
// 因为LazyComponent会修改tag和type属性,为了能识别,增加一个属性
|
// 因为LazyComponent会修改tag和type属性,为了能识别,增加一个属性
|
||||||
isLazyComponent: boolean = false;
|
isLazyComponent: boolean = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue