diff --git a/exclusion.dic b/exclusion.dic index 12d309e07..d63be7638 100644 --- a/exclusion.dic +++ b/exclusion.dic @@ -87,3 +87,4 @@ Searchs meili onerror dockview +Wwads diff --git a/src/BootstrapBlazor.Server/Components/Components/Wwads.razor b/src/BootstrapBlazor.Server/Components/Components/Wwads.razor index 22e615ec8..6a6af9a4d 100644 --- a/src/BootstrapBlazor.Server/Components/Components/Wwads.razor +++ b/src/BootstrapBlazor.Server/Components/Components/Wwads.razor @@ -1,4 +1,4 @@ @inherits WebSiteModuleComponentBase @attribute [JSModuleAutoLoader("Components/Wwads.razor.js", AutoInvokeDispose = false)] -
+
diff --git a/src/BootstrapBlazor.Server/Components/Components/Wwads.razor.cs b/src/BootstrapBlazor.Server/Components/Components/Wwads.razor.cs index f0c10f9be..df2525c23 100644 --- a/src/BootstrapBlazor.Server/Components/Components/Wwads.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Components/Wwads.razor.cs @@ -9,21 +9,26 @@ namespace BootstrapBlazor.Server.Components.Components; /// public partial class Wwads { - private string _debugString = "false"; + /// + /// 获得/设置 是否垂直布局 + /// + [Parameter] + public bool IsVertical { get; set; } private string? ClassString => CssBuilder.Default("bb-ad") + .AddClass("bb-ad-vertical", IsVertical) .AddClassFromAttributes(AdditionalAttributes) .Build(); +#if DEBUG + private readonly bool isDebug = true; +#else + private readonly bool isDebug = false; +#endif + /// /// /// - protected override void OnInitialized() - { - base.OnInitialized(); - -#if DEBUG - _debugString = "true"; -#endif - } + /// + protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, new { IsVertical, IsDebug = isDebug }); } diff --git a/src/BootstrapBlazor.Server/Components/Components/Wwads.razor.js b/src/BootstrapBlazor.Server/Components/Components/Wwads.razor.js index 553316fe6..79ddb7885 100644 --- a/src/BootstrapBlazor.Server/Components/Components/Wwads.razor.js +++ b/src/BootstrapBlazor.Server/Components/Components/Wwads.razor.js @@ -1,15 +1,17 @@ import { addLink } from '../../_content/BootstrapBlazor/modules/utility.js' -export async function init(id) { +export async function init(id, options) { var el = document.getElementById(id) if (el) { - await addLink("../../css/wwads.css") + await addLink("../../css/wwads.css"); - if (el.getAttribute('data-bb-debug') !== 'true') { + const { isVertical, isDebug } = options; + + if (isDebug === false) { const ad = document.createElement('div') ad.setAttribute("data-id", 72) ad.classList.add("wwads-cn") - ad.classList.add("wwads-horizontal") + ad.classList.add(isVertical ? "wwads-vertical" : "wwads-horizontal"); el.appendChild(ad); // const cc = document.createElement('div'); diff --git a/src/BootstrapBlazor.Server/Components/Layout/TutorialsLayout.razor b/src/BootstrapBlazor.Server/Components/Layout/TutorialsLayout.razor index b99c75069..14f5e5ff1 100644 --- a/src/BootstrapBlazor.Server/Components/Layout/TutorialsLayout.razor +++ b/src/BootstrapBlazor.Server/Components/Layout/TutorialsLayout.razor @@ -4,11 +4,11 @@
diff --git a/src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.css b/src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.css index 2f5417a15..b6cdaa8c7 100644 --- a/src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.css +++ b/src/BootstrapBlazor.Server/Components/Layout/TutorialsNavMenu.razor.css @@ -22,7 +22,6 @@ ::deep .scroll { overflow-x: hidden; - max-height: calc(100% - 36px); padding: 5px 0; } diff --git a/src/BootstrapBlazor.Server/wwwroot/css/wwads.css b/src/BootstrapBlazor.Server/wwwroot/css/wwads.css index bdf83ff4b..1abe2fd26 100644 --- a/src/BootstrapBlazor.Server/wwwroot/css/wwads.css +++ b/src/BootstrapBlazor.Server/wwwroot/css/wwads.css @@ -11,10 +11,10 @@ right: 0; } - .bb-ad[data-bb-debug="true"] { - background-color: #f4f8fa; - border-radius: 3px; - } +.bb-ad { + background-color: #f4f8fa; + border-radius: 3px; +} .bb-ad .wwads-horizontal, .bb-ad .wwads-vertical {