File tree Expand file tree Collapse file tree
src/Masa.Stack.Components/Shared/IntegrationComponents/Confirm Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11@inherits Masa .Blazor .Popup .Components .AlertingPopupComponentBase
22
3- <MDialog @bind- Value =" @Visible"
4- @bind-Value:after =" OnVisibleChanged"
3+ <MDialog Value =" @Visible"
4+ ValueChanged =" OnVisibleChanged"
55 Class =" pa-6"
66 ContentClass =" pa-6 white rounded-5"
77 Width =" 400" >
2222 <SIcon >mdi - close </SIcon >
2323 </MButton >
2424 </div >
25- }
25+ }
2626 </div >
2727 <div class =" regular2--text btn text-start my-3 px-9 @ContentClass" >
2828 @Content
3838
3939</MDialog >
4040
41- @code {
41+ @code {
4242
4343 [Parameter ]
4444 public string ? Title { get ; set ; }
7272
7373 private string ComputedCancelText => CancelText ?? T (" Cancel" );
7474 private string ComputedOkText => OkText ?? T (" Ok" );
75-
76- private async Task OnVisibleChanged ()
75+
76+ private async Task OnVisibleChanged (bool value )
7777 {
78+ Visible = value ;
7879 if (! Visible )
7980 {
8081 await SetResult (false );
Original file line number Diff line number Diff line change 11@inject MasaBlazor MasaBlazor
22@inject IJSRuntime JSRuntime
33@page " /users"
4+ @using Masa .Stack .Components .Extensions
45
56<ul >
67 <li ><a href =" /users/1?a=1" >User 1</a ></li >
1011 <li ><a href =" /users/5" >User 5</a ></li >
1112</ul >
1213
14+ <SButton Icon OnClick =" ShowConfirmAsync" >
15+ <SIcon >
16+ mdi-open-in-new
17+ </SIcon >
18+
19+ </SButton >
20+
21+
1322
1423<SDateTimeRangeToolbar ShowTimeZoneSelector ShowQuickChange ></SDateTimeRangeToolbar >
1524
132141</MThemeProvider >
133142
134143@code {
144+ [Inject ]
145+ IPopupService PopupService { get ; set ; } = default ! ;
135146
136147 private StringNumber _themeName = " light" ;
137148 private ThemeOptions ? _currentThemeOptions ;
211222 }
212223 };
213224
225+ private async Task ShowConfirmAsync ()
226+ {
227+ if (await PopupService .SimpleConfirmAsync (" 确认提示" ))
228+ {
229+ await PopupService .EnqueueSnackbarAsync (" OK" );
230+ }
231+ else
232+ {
233+ await PopupService .EnqueueSnackbarAsync (" Cancel" );
234+ }
235+ }
214236}
You can’t perform that action at this time.
0 commit comments