From 170f479d4ef30ea060d7be820ef3eee8fdb5f4b1 Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Thu, 27 Oct 2022 01:16:10 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=20Tooltip=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=A7=BB=E9=99=A4=20tooltip=20=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Tooltip/Tooltip.razor | 4 ++-- src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.cs | 6 ------ src/BootstrapBlazor/wwwroot/modules/tooltip.js | 5 ++--- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor b/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor index 33fc1c4a5..8a455163f 100644 --- a/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor +++ b/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor @@ -1,8 +1,8 @@ @namespace BootstrapBlazor.Components @inherits BootstrapModuleComponentBase - @ChildContent diff --git a/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.cs b/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.cs index 0a3f4b22e..112fe834d 100644 --- a/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.cs +++ b/src/BootstrapBlazor/Components/Tooltip/Tooltip.razor.cs @@ -133,10 +133,4 @@ public partial class Tooltip : ITooltip if (!string.IsNullOrEmpty(selector)) Selector = selector; StateHasChanged(); } - - /// - /// - /// - /// - protected override Task ModuleInitAsync() => InvokeInitAsync(Id, Title); } diff --git a/src/BootstrapBlazor/wwwroot/modules/tooltip.js b/src/BootstrapBlazor/wwwroot/modules/tooltip.js index bf330903f..648fdaaaf 100644 --- a/src/BootstrapBlazor/wwwroot/modules/tooltip.js +++ b/src/BootstrapBlazor/wwwroot/modules/tooltip.js @@ -8,8 +8,7 @@ export class Tooltip extends BlazorComponent { } _init() { - this._config.title = this._config.arguments[0] - this._tooltip = new bootstrap.Tooltip(this._element, this._config) + this._tooltip = new bootstrap.Tooltip(this._element) } _dispose() { @@ -18,7 +17,7 @@ export class Tooltip extends BlazorComponent { const tooltip = this._tooltip const handler = window.setTimeout(() => { window.clearTimeout(handler) - if (tooltip) { + if (tooltip && this._element) { tooltip.dispose() } }, delay) -- Gitee