From 8da1fbd4dd959e59b3287bde43749215f3ea207a Mon Sep 17 00:00:00 2001 From: Argo-Asicotech Date: Wed, 2 Nov 2022 19:16:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Responsive=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20IDispose=20=E6=8E=A5=E5=8F=A3=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResizeNotification/Responsive.cs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/ResizeNotification/Responsive.cs b/src/BootstrapBlazor/Components/ResizeNotification/Responsive.cs index b432d4d07..4b711bbb5 100644 --- a/src/BootstrapBlazor/Components/ResizeNotification/Responsive.cs +++ b/src/BootstrapBlazor/Components/ResizeNotification/Responsive.cs @@ -7,7 +7,7 @@ namespace BootstrapBlazor.Components; /// /// 响应监听 组件 /// -public class Responsive : BootstrapComponentBase +public class Responsive : BootstrapComponentBase, IDisposable { [Inject] [NotNull] @@ -39,4 +39,26 @@ public class Responsive : BootstrapComponentBase await OnBreakPointChanged(point); } } + + /// + /// Dispose 方法 + /// + /// + protected virtual void Dispose(bool disposing) + { + if (disposing) + { + ResizeService.Unsubscribe(this); + } + } + + /// + /// + /// + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } } -- Gitee