嗨,我正在使用NToastifyToastr处理来自服务器端的通知,但它无法正常工作。
以下是一些配置
services.AddMvc()
.AddRazorPagesOptions(options =>
{
options.Conventions.AuthorizeFolder("/Account");
options.Conventions.AllowAnonymousToPage("/Index");
})
.AddNToastNotifyToastr(new ToastrOptions()
{
ProgressBar = true,
PreventDuplicates = true,
TimeOut = 3000,
CloseEasing = true,
PositionClass = ToastPositions.TopCenter,
CloseButton = true,
CloseOnHover = true,
})
.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
测试一下,加载后我会显示一条消息
public class IndexModel : PageModel
{
private readonly IToastNotification _toastNotification;
public IndexModel(IToastNotification toastNotification)
{
_toastNotification = toastNotification;
}
public IActionResult OnGet()
{
//Success
_toastNotification.AddSuccessToastMessage("Welcome");
return Page();
}
}
但是,当我将鼠标悬停在烤面包机上时,烤面包机就会出现故障,无论之后如何,它都不会关闭。另外,点击关闭X按钮也无法将其关闭...我丢失了什么吗?