Match-id-3ae3d1647a5989cce8781b3c89facc876a1b71a3

This commit is contained in:
* 2022-08-08 11:55:07 +08:00 committed by *
parent d89c8b918c
commit 84f4423119
4 changed files with 7 additions and 7 deletions

View File

@ -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.src
); );
} }
arr.push(mappedChild); arr.push(mappedChild);

View File

@ -27,7 +27,7 @@ export function JSXElement(type, key, ref, vNode, props, source: Source | null)
} }
function isValidKey(key) { function isValidKey(key) {
const keyArray = ['key', 'ref', '__source', '__self']; const keyArray = ['key', 'ref', '__source'];
return !keyArray.includes(key); return !keyArray.includes(key);
} }
@ -41,8 +41,8 @@ function mergeDefault(sourceObj, defaultObj) {
function buildElement(isClone, type, setting, children) { function buildElement(isClone, type, setting, children) {
// setting中的值优先级最高clone情况下从 type 中取值,创建情况下直接赋值为 null // setting中的值优先级最高clone情况下从 type 中取值,创建情况下直接赋值为 null
const key = setting && setting.key !== undefined ? String(setting.key) : isClone ? type.key : null; const key = (setting && setting.key !== undefined) ? String(setting.key) : (isClone ? type.key : null);
const ref = setting && setting.ref !== undefined ? setting.ref : isClone ? type.ref : null; const ref = (setting && setting.ref !== undefined) ? setting.ref : (isClone ? type.ref : null);
const props = isClone ? { ...type.props } : {}; const props = isClone ? { ...type.props } : {};
let vNode = isClone ? type.belongClassVNode : getProcessingClassVNode(); let vNode = isClone ? type.belongClassVNode : getProcessingClassVNode();

View File

@ -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; src: any;
type: any; type: any;
key: any; key: any;
ref: any; ref: any;

View File

@ -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, src } = 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, src);
} }
} }