enable child component of cookie consent control.

This commit is contained in:
Ben
2025-02-24 22:32:19 +08:00
parent 982f3b1943
commit bf308dd13d

View File

@ -8,12 +8,22 @@
{ {
<form method="post" @formname="CookieConsentForm" @onsubmit="async () => await AcceptPolicy()" data-enhance> <form method="post" @formname="CookieConsentForm" @onsubmit="async () => await AcceptPolicy()" data-enhance>
<input type="hidden" name="@Constants.RequestVerificationToken" value="@SiteState.AntiForgeryToken" /> <input type="hidden" name="@Constants.RequestVerificationToken" value="@SiteState.AntiForgeryToken" />
@((MarkupString)Convert.ToString(Localizer["ConsentBody"])) @if (ChildContent != null)
{
@ChildContent
}
else
{
@((MarkupString)Convert.ToString(Localizer["ConsentBody"]))
}
</form> </form>
} }
@code { @code {
private bool showBanner; private bool showBanner;
[Parameter]
public RenderFragment ChildContent { get; set; } = null;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
showBanner = !(await CookieConsentService.CanTrackAsync()); showBanner = !(await CookieConsentService.CanTrackAsync());