diff --git a/packages/amis-editor/src/renderer/FormulaControl.tsx b/packages/amis-editor/src/renderer/FormulaControl.tsx index 39f478035..bc8b181dd 100644 --- a/packages/amis-editor/src/renderer/FormulaControl.tsx +++ b/packages/amis-editor/src/renderer/FormulaControl.tsx @@ -13,7 +13,7 @@ import isString from 'lodash/isString'; import isEqual from 'lodash/isEqual'; import omit from 'lodash/omit'; import cx from 'classnames'; -import {FormItem, Button, InputBox, Icon, ResultBox} from 'amis'; +import {FormItem, Button, InputBox, Icon, ResultBox, render} from 'amis'; import {FormulaExec, isExpression} from 'amis'; import {PickerContainer} from 'amis'; import {FormulaEditor} from 'amis-ui/lib/components/formula/Editor'; @@ -288,7 +288,8 @@ export default class FormulaControl extends React.Component< if (rendererSchema) { curRendererSchema = Object.assign({}, rendererSchema, data, { type: rendererSchema.type ?? data.type, - value: this.props.value ?? rendererSchema.value ?? data.value + // 说明: props.value 最后会同步到 rendererSchema.value 中 + value: rendererSchema.value // this.props.value ?? rendererSchema.value ?? data.value }); // 默认要剔除的字段 @@ -322,7 +323,7 @@ export default class FormulaControl extends React.Component< 'unitOptions', 'keyboard', 'kilobitSeparator', - 'value' + // 'value' ]; // 当前组件要剔除的字段 @@ -394,7 +395,7 @@ export default class FormulaControl extends React.Component< rendererWrapper, manager, useExternalFormData = false, - render, + // render, ...rest } = this.props; @@ -450,7 +451,7 @@ export default class FormulaControl extends React.Component< rendererWrapper ? 'border-wrapper' : '' )} > - {render('left', this.filterCustomRendererProps(rendererSchema), { + {render(this.filterCustomRendererProps(rendererSchema), { inputOnly: true, value: value, data: useExternalFormData