mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-15 17:31:42 +08:00
71bac2e85d
* Children components using CascadingParameter add itself to parent component.However, when children components disposed, they are not remove from parent component. For example, when items in checkgroup have changed , it may causes Index was outside the bounds of the array at AntDesign.CheckboxGroup.OnCheckboxChange.To fix these bug, Adding remove function in dispose process is the solution of this commit. * fix: some exception Co-authored-by: ElderJames <shunjiey@hotmail.com>
37 lines
906 B
C#
37 lines
906 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using OneOf;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class DescriptionsItem : AntDomComponentBase, IDescriptionsItem
|
|
{
|
|
[Parameter]
|
|
public OneOf<string, RenderFragment> Title { get; set; } = "";
|
|
|
|
[Parameter]
|
|
public int Span { get; set; } = 1;
|
|
|
|
[Parameter]
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
[CascadingParameter]
|
|
public Descriptions Descriptions { get; set; }
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
this.Descriptions?.Items.Remove(this);
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
this.Descriptions?.Items.Add(this);
|
|
base.OnInitialized();
|
|
}
|
|
}
|
|
}
|