Skip to content

fix(modal): [modal] repeatedly dispatch the close event #2573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/renderless/src/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export const handleEvent =
params.options = options
}

emit(type, params, event)
type !== 'close' && emit(type, params, event)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello你好,这个代码改了会导致有其他bug,排查了下你可以将377行代码:emit('close', params) 去掉,改掉目前这个问题。

Copy link
Contributor Author

@betavs betavs Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

将377行代码:emit('close', params) 去掉

标签式调用时,当点击 确定 | 取消 按钮时,会触发 confirm | cancel 事件,并不再触发 close 事件

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

点击 confirm 和 cancel 按钮,不需要触发close 事件,触发hide 事件。当点击close 按钮时触发close 事件即可

events[type] && events[type].call(parent, params)
api.close(type)
}
Expand Down