Skip to content

Commit

Permalink
fix: 修复弹窗嵌套弹窗观察动作执行逻辑错误 Close: baidu#10200
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop committed May 10, 2024
1 parent c9fa51e commit 59ea01f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 8 additions & 2 deletions packages/amis/src/renderers/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,10 @@ export default class Dialog extends React.Component<DialogProps> {
render(`action/${key}`, action, {
data: store.formData,
onAction: this.handleAction,
// 以免调用上层弹窗的 onActionSensor 方法
// 弹窗观察内部的动作执行,不需要观察到子弹窗里面去
// 所以这里传递了 undefined
onActionSensor: undefined,
key,
disabled: action.disabled || store.loading || !show
})
Expand Down Expand Up @@ -715,7 +719,8 @@ export default class Dialog extends React.Component<DialogProps> {
) : null}
{render('title', title, {
data: store.formData,
onAction: this.handleAction
onAction: this.handleAction,
onActionSensor: undefined
})}
</div>
) : showCloseButton !== false && !store.loading ? (
Expand All @@ -731,7 +736,8 @@ export default class Dialog extends React.Component<DialogProps> {
{header
? render('header', header, {
data: store.formData,
onAction: this.handleAction
onAction: this.handleAction,
onActionSensor: undefined
})
: null}

Expand Down
7 changes: 5 additions & 2 deletions packages/amis/src/renderers/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ export default class Drawer extends React.Component<DrawerProps> {
{actions.map((action, key) =>
render(`action/${key}`, action, {
onAction: this.handleAction,
onActionSensor: undefined,
data: store.formData,
key,
disabled: action.disabled || store.loading
Expand Down Expand Up @@ -684,7 +685,8 @@ export default class Drawer extends React.Component<DrawerProps> {
data: store.formData,
onConfirm: this.handleDrawerConfirm,
onClose: this.handleDrawerClose,
onAction: this.handleAction
onAction: this.handleAction,
onActionSensor: undefined
})}
</div>
) : null}
Expand All @@ -693,7 +695,8 @@ export default class Drawer extends React.Component<DrawerProps> {
data: store.formData,
onConfirm: this.handleDrawerConfirm,
onClose: this.handleDrawerClose,
onAction: this.handleAction
onAction: this.handleAction,
onActionSensor: undefined
})
: null}
</div>
Expand Down

0 comments on commit 59ea01f

Please sign in to comment.