Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
[fix] bug 构建style应该重写BuildStyle方法
Browse files Browse the repository at this point in the history
  • Loading branch information
elvismile committed Nov 28, 2022
1 parent e7f08e5 commit b855c96
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/TDesign/Components/TAffix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected async override Task OnAfterRenderAsync(bool firstRender)
if (firstRender)
{
var objRef = DotNetObjectReference.Create(this);
var popperWrapper = await JS.Value.InvokeAsync<IJSInProcessObjectReference>("import", "./_content/TDesign/tdesign-blazor.js");
var popperWrapper = await JS.Value.InvokeAsync<IJSObjectReference>("import", "./_content/TDesign/tdesign-blazor.js");
await popperWrapper.InvokeVoidAsync("affix.init", Container, objRef);

}
Expand All @@ -60,31 +60,18 @@ protected async override Task OnAfterRenderAsync(bool firstRender)
/// <param name="builder"></param>
protected override void BuildCssClass(ICssClassBuilder builder)
{
if (_fixed)
{
if (!builder.Contains(CSS_NAME))
{
builder.Append(CSS_NAME);
}
}
else
{
if (builder.Contains(CSS_NAME))
{
builder.Remove(CSS_NAME);
}
}
builder.Append(CSS_NAME, _fixed);
base.BuildCssClass(builder);
}

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="attributes"></param>
protected override void BuildAttributes(IDictionary<string, object> attributes)
/// <param name="builder"></param>
protected override void BuildStyle(IStyleBuilder builder)
{
attributes["style"] = HtmlHelper.Style.Append(_fixedStyle, _fixed);
base.BuildAttributes(attributes);
builder.Append(_fixedStyle, _fixed);
base.BuildStyle(builder);
}

/// <summary>
Expand Down

0 comments on commit b855c96

Please sign in to comment.