File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ protected override void OnInitialized()
4848
4949 // 注册 Dialog 弹窗事件
5050 DialogService . Register ( this , Show ) ;
51+
52+ // 增加参数
53+ AdditionalAttributes ??= new Dictionary < string , object > ( ) ;
54+ AdditionalAttributes [ "data-bb-dialog" ] = "true" ;
5155 }
5256
5357 /// <summary>
Original file line number Diff line number Diff line change @@ -7,22 +7,26 @@ export class Modal extends BlazorComponent {
77 this . _invoker = this . _config . arguments [ 0 ]
88 this . _invokerShownMethod = this . _config . arguments [ 1 ]
99 this . _invokerCloseMethod = this . _config . arguments [ 2 ]
10+ this . _isDialog = this . _config . dialog === true
1011 this . _setEventListeners ( )
1112 }
1213
1314 _setEventListeners ( ) {
1415 EventHandler . on ( this . _element , 'shown.bs.modal' , ( ) => {
1516 this . _invoker . invokeMethodAsync ( this . _invokerShownMethod )
1617 } )
17- EventHandler . on ( this . _element , 'hide.bs.modal' , ( ) => {
18+ EventHandler . on ( this . _element , 'hide.bs.modal' , e => {
19+ e . stopPropagation ( ) ;
1820 if ( this . _draggable ) {
1921 this . _dialog . style . width = ''
2022 this . _dialog . style . margin = ''
2123
2224 EventHandler . off ( this . _dialog , 'mousedown' )
2325 EventHandler . off ( this . _dialog , 'touchstart' )
2426 }
25- this . _invoker . invokeMethodAsync ( this . _invokerCloseMethod )
27+ if ( this . _isDialog ) {
28+ this . _invoker . invokeMethodAsync ( this . _invokerCloseMethod )
29+ }
2630 } )
2731
2832 this . _pop = ( ) => {
You can’t perform that action at this time.
0 commit comments