Skip to content

Commit f5ce1d0

Browse files
authored
fix(Modal): styles remain when modal are destroyed (#5538)
* refactor: 增加 Modal 销毁时关闭弹窗逻辑 * chore: bump version 9.4.7-beta02
1 parent 247e186 commit f5ce1d0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.4.7-beta01</Version>
4+
<Version>9.4.7-beta02</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

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

+7-2
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)