diff --git a/src/playground/actor-editor.tsx b/src/playground/actor-editor.tsx index 6b7dbc5f8..f5ff84d7d 100644 --- a/src/playground/actor-editor.tsx +++ b/src/playground/actor-editor.tsx @@ -235,6 +235,7 @@ const ActorEditor = React.memo(() => { enableClipboard={false} displayObjectSize={false} displayDataTypes={false} + collapsed={1} /> ); }, [currentGlobal, renderKey]); diff --git a/src/playground/editor/example/xml/coc7.xml b/src/playground/editor/example/xml/coc7.xml index 2430b669b..27a202ba1 100644 --- a/src/playground/editor/example/xml/coc7.xml +++ b/src/playground/editor/example/xml/coc7.xml @@ -152,11 +152,42 @@
+ + + + + + {{props.skillName}} + {{基础}} + + + + {{SUM(基础, 成长, 职业, 兴趣)}} + + + - - + + + + + + + + + + + + + + + + + +
技能初始成长职业兴趣成功率
+
diff --git a/src/shared/components/layout/tags/Base/shared.tsx b/src/shared/components/layout/tags/Base/shared.tsx index 6f4042a2c..10f121857 100644 --- a/src/shared/components/layout/tags/Base/shared.tsx +++ b/src/shared/components/layout/tags/Base/shared.tsx @@ -51,7 +51,7 @@ export const TagBaseShared: TagComponent = React.memo((props) => { const Tag = normalizeTagName(tagName); if (Tag === React.Fragment) { - return React.createElement(Tag, { key: props.key }, childrens); + return React.createElement(Tag, {}, childrens); } // 是HTML元素 diff --git a/src/shared/components/layout/tags/Computed/shared.tsx b/src/shared/components/layout/tags/Computed/shared.tsx index 21b091f70..e0cb8bbe6 100644 --- a/src/shared/components/layout/tags/Computed/shared.tsx +++ b/src/shared/components/layout/tags/Computed/shared.tsx @@ -8,6 +8,7 @@ import { TagComponent } from '../type'; import { LayoutStateContext } from '../../context/LayoutStateContext'; import { parseDataText } from '../../processor'; import { useLayoutFieldState } from '../../hooks/useLayoutFieldState'; +import { getStateValue } from '../utils'; interface TagProps { deps: string | string[]; @@ -26,7 +27,8 @@ export const TagComputedShared: TagComponent = React.memo((props) => { return props.deps; }, [props.deps]); - const watchValues = deps.map((name) => context.state.data[name]); + const watchValues = deps.map((name) => getStateValue(context, name)); + useEffect(() => { if (deps.includes(props.target)) { console.warn('circle deps:', deps, props.target); @@ -35,7 +37,7 @@ export const TagComputedShared: TagComponent = React.memo((props) => { const value = parseDataText(`{{(${props.expression})}}`, context); - setStateValue(value || null); + setStateValue(value ?? null); }, [...watchValues, props.target, props.expression]); return null;