mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-15 17:31:18 +08:00
添加过的事件禁用
Change-Id: Ica47534ee092cf4fd5f8d17b73bc456c28d29348
This commit is contained in:
parent
3282287beb
commit
3e8c095493
@ -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 (
|
||||
<div className="ae-event-control">
|
||||
<header
|
||||
@ -647,9 +645,12 @@ export class EventControl extends React.Component<
|
||||
closeOnClick: true,
|
||||
buttons: events.map(item => ({
|
||||
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))
|
||||
}))
|
||||
})}
|
||||
</header>
|
||||
|
Loading…
Reference in New Issue
Block a user