Match-id-9914aef941bed130e5727dba91ebbb4667de2798

This commit is contained in:
* 2022-08-05 17:54:05 +08:00 committed by *
parent b14bf9f4c0
commit 8f7e8e63e1
4 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import {throwIfTrue} from '../renderer/utils/throwIfTrue';
import {TYPE_COMMON_ELEMENT, TYPE_PORTAL} from './JSXElementType';
import { throwIfTrue } from '../renderer/utils/throwIfTrue';
import { TYPE_COMMON_ELEMENT, TYPE_PORTAL } from './JSXElementType';
import {isValidElement, JSXElement} from './JSXElement';
import { isValidElement, JSXElement } from './JSXElement';
// 生成key
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.belongClassVNode,
mappedChild.props,
mappedChild.source,
mappedChild._source
);
}
arr.push(mappedChild);
@ -113,4 +113,4 @@ const Children = {
},
};
export {Children};
export { Children };

View File

@ -13,7 +13,7 @@ export function JSXElement(type, key, ref, vNode, props, source: Source | null)
return {
// 元素标识符
vtype: TYPE_COMMON_ELEMENT,
source: isDev ? source : null,
_source: isDev ? source : null,
// 属于元素的内置属性
type: type,

View File

@ -12,7 +12,7 @@ export type UseContextHookType = { useContext<T>(context: ContextType<T>): T };
export type JSXElement = {
vtype: any;
source: any;
_source: any;
type: any;
key: any;
ref: any;

View File

@ -185,12 +185,12 @@ export function createVNode(tag: VNodeTag | string, ...secondArg) {
}
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) {
return createFragmentVNode(key, props.children);
} else {
return createUndeterminedVNode(type, key, props, source);
return createUndeterminedVNode(type, key, props, _source);
}
}