diff --git a/libs/horizon/src/external/ChildrenUtil.ts b/libs/horizon/src/external/ChildrenUtil.ts index e42091fb..bb5b51c2 100644 --- a/libs/horizon/src/external/ChildrenUtil.ts +++ b/libs/horizon/src/external/ChildrenUtil.ts @@ -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, 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 }; diff --git a/libs/horizon/src/external/JSXElement.ts b/libs/horizon/src/external/JSXElement.ts index c2b4855e..6b108461 100644 --- a/libs/horizon/src/external/JSXElement.ts +++ b/libs/horizon/src/external/JSXElement.ts @@ -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, diff --git a/libs/horizon/src/renderer/Types.ts b/libs/horizon/src/renderer/Types.ts index b05f5be4..c79a81c9 100644 --- a/libs/horizon/src/renderer/Types.ts +++ b/libs/horizon/src/renderer/Types.ts @@ -12,7 +12,7 @@ export type UseContextHookType = { useContext(context: ContextType): T }; export type JSXElement = { vtype: any; - source: any; + _source: any; type: any; key: any; ref: any; diff --git a/libs/horizon/src/renderer/vnode/VNodeCreator.ts b/libs/horizon/src/renderer/vnode/VNodeCreator.ts index ff906d59..88ee2928 100644 --- a/libs/horizon/src/renderer/vnode/VNodeCreator.ts +++ b/libs/horizon/src/renderer/vnode/VNodeCreator.ts @@ -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); } }