Skip to content

Commit 8672eab

Browse files
committed
feat: 增加 Show/Hide/Toggle 实例方法
1 parent e301a18 commit 8672eab

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/BootstrapBlazor/Components/Tooltip/ITooltip.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ public interface ITooltip
2626
bool IsHtml { get; set; }
2727

2828
/// <summary>
29-
/// 获得/设置 触发方式 可组合 click focus hover 默认为 focus hover
29+
/// 获得/设置 触发方式 可组合 click focus hover manual 默认为 focus hover
3030
/// </summary>
31+
/// <remarks>设置 manual 时,请使用 <see cref="Tooltip"/> 组件实例方法 <see cref="Tooltip.Show(int?)"/> <see cref="Tooltip.Hide(int?)"/> <see cref="Tooltip.Toggle(int?)"/> 对弹窗状态进行控制</remarks>
3132
string? Trigger { get; set; }
3233

3334
/// <summary>

src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,4 +156,25 @@ public void SetParameters(string title, Placement placement = Placement.Auto, st
156156
if (!string.IsNullOrEmpty(offset)) Offset = offset;
157157
StateHasChanged();
158158
}
159+
160+
/// <summary>
161+
/// 显示 Tooltip 弹窗方法
162+
/// </summary>
163+
/// <param name="delay">延时指定毫秒后显示弹窗 默认 null 不延时</param>
164+
/// <returns></returns>
165+
public Task Show(int? delay = null) => InvokeVoidAsync("show", Id, delay);
166+
167+
/// <summary>
168+
/// 关闭 Tooltip 弹窗方法
169+
/// </summary>
170+
/// <param name="delay">延时指定毫秒后关闭弹窗 默认 null 不延时</param>
171+
/// <returns></returns>
172+
public Task Hide(int? delay = null) => InvokeVoidAsync("hide", Id, delay);
173+
174+
/// <summary>
175+
/// 切换 Tooltip 弹窗当前状态方法
176+
/// </summary>
177+
/// <param name="delay">延时指定毫秒后切换弹窗方法 默认 null 不延时</param>
178+
/// <returns></returns>
179+
public Task Toggle(int? delay = null) => InvokeVoidAsync("toggle", Id, delay);
159180
}

0 commit comments

Comments
 (0)