From c0b033afa2a32187515aec480d906e918970c52f Mon Sep 17 00:00:00 2001 From: Argo-Tianyi Date: Sun, 27 Mar 2022 20:17:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA/=E9=94=80=E6=AF=81=20Tooltip=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Button/ButtonBase.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/BootstrapBlazor/Components/Button/ButtonBase.cs b/src/BootstrapBlazor/Components/Button/ButtonBase.cs index 89ceb67e5..246280938 100644 --- a/src/BootstrapBlazor/Components/Button/ButtonBase.cs +++ b/src/BootstrapBlazor/Components/Button/ButtonBase.cs @@ -211,4 +211,29 @@ public abstract class ButtonBase : TooltipComponentBase IsDisabled = disable; StateHasChanged(); } + + /// + /// 显示 Tooltip 方法 + /// + /// + /// + public virtual async Task ShowTooltip(string message) + { + if (!string.IsNullOrEmpty(Id)) + { + await JSRuntime.InvokeVoidAsync(null, "bb_tooltip", Id, "show", message, "auto", false, "focus"); + } + } + + /// + /// 销毁 Tooltip 方法 + /// + /// + public virtual async Task RemoveTooltip() + { + if (!string.IsNullOrEmpty(Id)) + { + await JSRuntime.InvokeVoidAsync(null, "bb_tooltip", Id, "dispose"); + } + } } -- Gitee From 80abd5b8f64bab2738e94d1d0887303c43a20a40 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Mon, 28 Mar 2022 00:51:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/ButtonTest.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/UnitTest/Components/ButtonTest.cs b/test/UnitTest/Components/ButtonTest.cs index b11ead527..bd69746b4 100644 --- a/test/UnitTest/Components/ButtonTest.cs +++ b/test/UnitTest/Components/ButtonTest.cs @@ -321,4 +321,18 @@ public class ButtonTest : BootstrapBlazorTestBase await tcs.Task; Assert.True(valid); } + + [Fact] + public async Task ShowTooltip_Ok() + { + var cut = Context.RenderComponent