mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-04 13:08:23 +08:00
fix(module: tabs): some issues with dynamic rendering (#2967)
* fix(module: tabs): render issues * remove change avoiding
This commit is contained in:
parent
9f7964ecb9
commit
d852ed4da8
@ -53,6 +53,7 @@ namespace AntDesign
|
||||
|
||||
[Parameter]
|
||||
public bool Closable { get; set; } = true;
|
||||
|
||||
internal bool IsActive => _isActive;
|
||||
|
||||
private bool HasTabTitle => Tab != null || TabTemplate != null;
|
||||
@ -63,9 +64,9 @@ namespace AntDesign
|
||||
|
||||
private ElementReference _tabRef;
|
||||
private bool _isActive;
|
||||
private bool _shouldRender;
|
||||
private bool _shouldTabRender;
|
||||
|
||||
private bool _hasClosed;
|
||||
|
||||
private bool _hasRendered;
|
||||
|
||||
protected override void OnInitialized()
|
||||
@ -85,27 +86,6 @@ namespace AntDesign
|
||||
{
|
||||
_hasRendered = true;
|
||||
}
|
||||
|
||||
_shouldRender = false;
|
||||
_shouldTabRender = false;
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
_shouldRender = true;
|
||||
_shouldTabRender = true;
|
||||
}
|
||||
|
||||
public override async Task SetParametersAsync(ParameterView parameters)
|
||||
{
|
||||
// Avoid changes in tab as we modify the properties used for display when drag and drop occurs
|
||||
if (IsTab && _hasRendered)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await base.SetParametersAsync(parameters);
|
||||
}
|
||||
|
||||
private void SetClass()
|
||||
@ -127,7 +107,6 @@ namespace AntDesign
|
||||
if (_isActive != isActive)
|
||||
{
|
||||
_isActive = isActive;
|
||||
_shouldTabRender = true;
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
@ -136,9 +115,6 @@ namespace AntDesign
|
||||
{
|
||||
_hasClosed = true;
|
||||
|
||||
_shouldTabRender = true;
|
||||
_shouldRender = true;
|
||||
|
||||
Dispose();
|
||||
}
|
||||
|
||||
@ -149,16 +125,6 @@ namespace AntDesign
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected override bool ShouldRender()
|
||||
{
|
||||
if (IsTab)
|
||||
{
|
||||
return _shouldTabRender;
|
||||
}
|
||||
|
||||
return _shouldRender;
|
||||
}
|
||||
|
||||
internal void ExchangeWith(TabPane other)
|
||||
{
|
||||
var temp = other.Clone();
|
||||
@ -186,7 +152,6 @@ namespace AntDesign
|
||||
Disabled = tabPane.Disabled;
|
||||
Closable = tabPane.Closable;
|
||||
|
||||
_shouldTabRender = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user