From 3e8c095493d430de5383ffffb2d0d6a3c69d05d8 Mon Sep 17 00:00:00 2001 From: pianruijie Date: Mon, 22 Aug 2022 16:48:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=87=E7=9A=84=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ica47534ee092cf4fd5f8d17b73bc456c28d29348 --- .../amis-editor/src/renderer/event-control/index.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/amis-editor/src/renderer/event-control/index.tsx b/packages/amis-editor/src/renderer/event-control/index.tsx index 8035dc50f..1483ba876 100644 --- a/packages/amis-editor/src/renderer/event-control/index.tsx +++ b/packages/amis-editor/src/renderer/event-control/index.tsx @@ -150,13 +150,12 @@ export class EventControl extends React.Component< return Object.keys(onEvent).length ? onEvent : {}; } - addEvent(event: RendererPluginEvent) { + addEvent(event: RendererPluginEvent, disabled: boolean) { const {onChange} = this.props; let onEvent = { ...this.state.onEvent }; - - if (onEvent[`${event.eventName}`]) { + if (disabled) { return; } onEvent[`${event.eventName}`] = { @@ -628,7 +627,6 @@ export class EventControl extends React.Component< const enventSnapshot = cloneDeep(onEvent); const {showOldEntry} = this.props; const eventKeys = Object.keys(enventSnapshot); - return (
({ type: 'button', + disabledTip: '您已添加该事件', + tooltipPlacement: 'left', + disabled: Object.keys(onEvent).includes(item.eventName), actionType: '', label: item.eventLabel, - onClick: this.addEvent.bind(this, item) + onClick: this.addEvent.bind(this, item, Object.keys(onEvent).includes(item.eventName)) })) })}