diff --git a/docs/zh-CN/components/form/picker.md b/docs/zh-CN/components/form/picker.md index b3a1b1e81ae..0af53e36599 100755 --- a/docs/zh-CN/components/form/picker.md +++ b/docs/zh-CN/components/form/picker.md @@ -1211,7 +1211,7 @@ order: 35 | pickerSchema | `string` | `{mode: 'list', listItem: {title: '${label}'}}` | 即用 List 类型的渲染,来展示列表信息。更多配置参考 [CRUD](../crud) | | embed | `boolean` | `false` | 是否使用内嵌模式 | | overflowConfig | `OverflowConfig` | 参考[OverflowConfig](./#overflowconfig) | 开启最大标签展示数量的相关配置 `3.4.0` | -| itemCanDelete | `itemCanDelete` | `true` | 用于控制是否显示选中项的删除图标,默认值为 `true` | `6.9.0` | +| removeable | `removeable` | `true` | 用于控制是否显示选中项的删除图标,默认值为 `true` | `6.10.0` | ### OverflowConfig diff --git a/packages/amis-editor/src/plugin/Form/Picker.tsx b/packages/amis-editor/src/plugin/Form/Picker.tsx index 6c3a3a32866..bdb82273094 100644 --- a/packages/amis-editor/src/plugin/Form/Picker.tsx +++ b/packages/amis-editor/src/plugin/Form/Picker.tsx @@ -402,7 +402,7 @@ export class PickerControlPlugin extends BasePlugin { }, { type: 'switch', - name: 'itemCanDelete', + name: 'removeable', label: '选中项可删除', pipeIn: defaultValue(true), inputClassName: 'is-inline ' diff --git a/packages/amis/src/renderers/Form/Picker.tsx b/packages/amis/src/renderers/Form/Picker.tsx index 013f5e83119..5a101e2935e 100644 --- a/packages/amis/src/renderers/Form/Picker.tsx +++ b/packages/amis/src/renderers/Form/Picker.tsx @@ -105,7 +105,7 @@ export interface PickerControlSchema extends FormOptionsSchema { /** * 选中项可删除,默认为true */ - itemCanDelete?: boolean; + removeable?: boolean; } export interface PickerProps extends OptionsControlProps { @@ -228,17 +228,6 @@ export default class PickerControl extends React.PureComponent< this.mounted = false; } - @autobind - getCtx() { - // 用于外围扩充,勿删 - const {value, valueField, data} = this.props; - return createObject(data, { - value: value, - [valueField || 'value']: value, - op: 'loadOptions' - }); - } - @autobind fetchOptions(): any { const {value, formItem, valueField, labelField, source, data} = this.props; @@ -256,7 +245,11 @@ export default class PickerControl extends React.PureComponent< return; } - const ctx = this.getCtx(); + const ctx = createObject(data, { + value: value, + [valueField || 'value']: value, + op: 'loadOptions' + }); if (isPureVariable(source)) { formItem.setOptions(resolveVariableAndFilter(source, data, '| raw')); @@ -536,7 +529,7 @@ export default class PickerControl extends React.PureComponent< renderTag(item: Option, index: number) { const { - itemCanDelete = true, + removeable = true, classPrefix: ns, classnames: cx, labelField, @@ -565,7 +558,7 @@ export default class PickerControl extends React.PureComponent< } )} > - {itemCanDelete && ( + {removeable && (