Skip to content

Commit b1f7573

Browse files
committed
refactor: 增加 Modal 销毁时关闭弹窗逻辑
1 parent 247e186 commit b1f7573

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/BootstrapBlazor/Components/Modal/Modal.razor.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,13 @@ export function dispose(id) {
137137
}
138138

139139
EventHandler.off(window, 'popstate', modal.pop)
140-
if (modal.modal) {
141-
modal.modal.dispose()
140+
const dialog = modal.modal;
141+
if (dialog) {
142+
if (document.body.classList.contains('modal-open')) {
143+
dialog._backdrop._config.isAnimated = false;
144+
dialog._hideModal();
145+
}
146+
dialog.dispose()
142147
}
143148
}
144149
}

0 commit comments

Comments
 (0)