Match-id-9914aef941bed130e5727dba91ebbb4667de2798
This commit is contained in:
parent
b14bf9f4c0
commit
8f7e8e63e1
|
@ -1,7 +1,7 @@
|
||||||
import {throwIfTrue} from '../renderer/utils/throwIfTrue';
|
import { throwIfTrue } from '../renderer/utils/throwIfTrue';
|
||||||
import {TYPE_COMMON_ELEMENT, TYPE_PORTAL} from './JSXElementType';
|
import { TYPE_COMMON_ELEMENT, TYPE_PORTAL } from './JSXElementType';
|
||||||
|
|
||||||
import {isValidElement, JSXElement} from './JSXElement';
|
import { isValidElement, JSXElement } from './JSXElement';
|
||||||
|
|
||||||
// 生成key
|
// 生成key
|
||||||
function getItemKey(item: any, index: number): string {
|
function getItemKey(item: any, index: number): string {
|
||||||
|
@ -70,7 +70,7 @@ function callMapFun(children: any, arr: Array<any>, prefix: string, callback: Fu
|
||||||
mappedChild.ref,
|
mappedChild.ref,
|
||||||
mappedChild.belongClassVNode,
|
mappedChild.belongClassVNode,
|
||||||
mappedChild.props,
|
mappedChild.props,
|
||||||
mappedChild.source,
|
mappedChild._source
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
arr.push(mappedChild);
|
arr.push(mappedChild);
|
||||||
|
@ -113,4 +113,4 @@ const Children = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export {Children};
|
export { Children };
|
||||||
|
|
|
@ -13,7 +13,7 @@ export function JSXElement(type, key, ref, vNode, props, source: Source | null)
|
||||||
return {
|
return {
|
||||||
// 元素标识符
|
// 元素标识符
|
||||||
vtype: TYPE_COMMON_ELEMENT,
|
vtype: TYPE_COMMON_ELEMENT,
|
||||||
source: isDev ? source : null,
|
_source: isDev ? source : null,
|
||||||
|
|
||||||
// 属于元素的内置属性
|
// 属于元素的内置属性
|
||||||
type: type,
|
type: type,
|
||||||
|
|
|
@ -12,7 +12,7 @@ export type UseContextHookType = { useContext<T>(context: ContextType<T>): T };
|
||||||
|
|
||||||
export type JSXElement = {
|
export type JSXElement = {
|
||||||
vtype: any;
|
vtype: any;
|
||||||
source: any;
|
_source: any;
|
||||||
type: any;
|
type: any;
|
||||||
key: any;
|
key: any;
|
||||||
ref: any;
|
ref: any;
|
||||||
|
|
|
@ -185,12 +185,12 @@ export function createVNode(tag: VNodeTag | string, ...secondArg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createVNodeFromElement(element: JSXElement): VNode {
|
export function createVNodeFromElement(element: JSXElement): VNode {
|
||||||
const { type, key, props, source } = element;
|
const { type, key, props, _source } = element;
|
||||||
|
|
||||||
if (type === TYPE_STRICT_MODE || type === TYPE_FRAGMENT || type === TYPE_PROFILER) {
|
if (type === TYPE_STRICT_MODE || type === TYPE_FRAGMENT || type === TYPE_PROFILER) {
|
||||||
return createFragmentVNode(key, props.children);
|
return createFragmentVNode(key, props.children);
|
||||||
} else {
|
} else {
|
||||||
return createUndeterminedVNode(type, key, props, source);
|
return createUndeterminedVNode(type, key, props, _source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue