
SweetAlert popup component
Modal dialog box, mostly used to continue after inquiring during the action, or to display the execution result
Component usage introduction:
1. Inject the service SwalService
@inject SwalService SwalService
[Inject]
[NotNull]
private SwalService? SwalService { get; set; }
2. Call its instance api
var op = new SwalOption()
{
Category = SwalCategory.Success,
Title = "I am Title",
Content = "I am Content",
ShowClose = false
};
await SwalService.Show(op);
Call Swal
by injecting the service to pop up a dialog
Demo
By setting Title
Content
is used to display the title and content of the pop-up window
Demo
Customize the buttons in the pop-up window by setting ButtonTemplate
Demo
By setting the Component
popup content as a custom component
Demo
By calling the await SwalService.ShowModal
method, the modal box is popped up. After clicking the button in the pop-up window to close the pop-up window, the subsequent code continues to execute.
Demo
This sample code calls The method await SwalService.ShowModal
pops up a modal box, and the subsequent code continues to execute only after the pop-up window is closed.
IsConfirm
The parameter indicates that the pop-up window is a confirmation window, and two buttons are automatically generated Cancel
Confirm
var ret = await SwalService.ShowModal(op);
// ShowModal
Trace.Log($"{ret}");
Customize the Footer template by setting FooterTemplate
Demo
parameter ShowFooter
The default is false
to not display the footer template, it needs to be set to true
Customize the auto-close time by setting the IsAutoHide
Delay
property
Demo
parameter IsAutoHide
Defaults to false
to disable auto-close, The parameter Delay
defaults to 4000 milliseconds
Attributes
B station related video link
交流群