From 67610f1458bf7d60cc3e36e301513196e61f4a25 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 2 Mar 2025 01:22:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?doc:=20=E4=BD=BF=E7=94=A8=20BootstrapBlazor?= =?UTF-8?q?RootContent=20=E9=87=8D=E6=9E=84=E6=A0=B7=E5=BC=8F=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Components/ThemeChooser.razor | 11 +++++++---- .../Components/Layout/MainLayout.razor | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor b/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor index c53b4e26292..88cef219652 100644 --- a/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor +++ b/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor @@ -9,9 +9,12 @@ } -
- -
+
+ +
+ + +
@HeaderText
@@ -23,4 +26,4 @@
}
-
+ diff --git a/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor b/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor index 4b08fd9cdd9..b2c7a737c7f 100644 --- a/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor +++ b/src/BootstrapBlazor.Server/Components/Layout/MainLayout.razor @@ -31,9 +31,9 @@ - @* + - *@ + From e112b64adc841701c0b0d78acf60b39648e7e3ce Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Sun, 2 Mar 2025 01:22:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20=E6=9B=B4=E6=96=B0=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=80=89=E6=8B=A9=E5=BC=B9=E7=AA=97=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/ThemeChooser.razor.js | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor.js b/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor.js index 460a8bdaa84..9efccd34bdb 100644 --- a/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor.js +++ b/src/BootstrapBlazor.Server/Components/Components/ThemeChooser.razor.js @@ -1,26 +1,29 @@ -import { insertAfter } from "../../_content/BootstrapBlazor/modules/utility.js" -import Data from "../../_content/BootstrapBlazor/modules/data.js" -import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js" +import EventHandler from "../../_content/BootstrapBlazor/modules/event-handler.js" export function init(id) { - const el = document.getElementById(id) + const el = document.getElementById(id); if (el === null) { - return + return; } - const themeList = el.querySelector('.theme-list') - - Data.set(id, { el }); + const themeList = document.querySelector('.theme-list'); + const close = document.querySelector('.theme-list .btn-close'); EventHandler.on(el, 'click', () => { - themeList.classList.toggle('is-open') - }) + themeList.classList.toggle('is-open'); + }); + EventHandler.on(close, 'click', () => { + themeList.classList.remove('is-open'); + }); } export function dispose(id) { - const theme = Data.get(id) - Data.remove(id) + const el = document.getElementById(id); + if (el) { + EventHandler.off(el, 'click'); + } - if (theme) { - EventHandler.off(theme.el, 'click') + const close = document.querySelector('.theme-list .btn-close'); + if (close) { + EventHandler.off(close, 'click'); } }