feat: Toast 增加 Id 防止多个 toast 时产生错误

This commit is contained in:
Argo-2016 2020-01-07 17:12:05 +08:00
parent a90a478348
commit 74fef7fdc6
3 changed files with 9 additions and 3 deletions

View File

@ -51,6 +51,12 @@ namespace Bootstrap.Admin.Components
[Parameter]
public string Text { get; set; } = "Toast 消息正文内容-未设置";
/// <summary>
/// 获得/设置 组件 ID
/// </summary>
[Parameter]
public string Id { get; set; } = "";
/// <summary>
/// 控件呈现后回调方法
/// </summary>

View File

@ -19,7 +19,7 @@
</div>
<div class="table-wrapper">
<table class="table table-striped table-bordered table-hover table-selected">
<table class="table table-striped table-bordered table-hover table-selected" id="@Id">
<thead>
<tr>
@if (ShowLineNo)
@ -87,4 +87,4 @@
</ModalBody>
</SubmitModal>
<Toast @ref="Toast"></Toast>
<Toast @ref="Toast" Id="@($"{Id}_toast")"></Toast>

View File

@ -1,6 +1,6 @@
@inherits ToastBase
<div class="toast fade @Placement.ToCss("toast")" role="alert" aria-live="assertive" aria-atomic="true" data-autohide="@(AutoHide ? "true":"false")" data-delay="@Interval">
<div class="toast fade @Placement.ToCss("toast")" id="@Id" role="alert" aria-live="assertive" aria-atomic="true" data-autohide="@(AutoHide ? "true":"false")" data-delay="@Interval">
<div class="toast-header">
<div class="toast-bar"><i class="@RenderCategory()"></i></div>
<strong class="mr-auto">@Title</strong>