fix(module: radio): disabled in radio group doesn't work (#503)

This commit is contained in:
James Yeung 2020-08-13 23:32:51 +08:00 committed by GitHub
parent 9b0f95ef3a
commit 81cce2a2d5
3 changed files with 17 additions and 16 deletions

View File

@ -79,6 +79,11 @@ namespace AntDesign
SetClass();
RadioGroup?.AddRadio(this);
if (RadioGroup != null && RadioGroup.Disabled)
{
Disabled = true;
}
base.OnInitialized();
}
@ -110,17 +115,21 @@ namespace AntDesign
internal async Task UnSelect()
{
if (this.IsChecked)
if (!Disabled && this.IsChecked)
{
this._checked = false;
await CheckedChange.InvokeAsync(false);
await CheckedChanged.InvokeAsync(false);
}
await Task.CompletedTask;
}
public async Task OnClick()
{
if (Disabled)
{
return;
}
if (RadioGroup != null)
{
await RadioGroup.OnRadioChange(this.Value);

View File

@ -1,9 +1 @@
@import './index.less';
.@{radio-group-prefix-cls} {
font-size: 0;
}
.@{radio-prefix-cls}-button-wrapper {
font-size: @font-size-base;
}
@import './index.less';

View File

@ -15,11 +15,11 @@
</RadioGroup>
<br />
<br />
<RadioGroup @bind-Value="radioValue3">
<Radio RadioButton Value="@("A")" Disabled>Hangzhou</Radio>
<Radio RadioButton Value="@("B")" Disabled>Shanghai</Radio>
<Radio RadioButton Value="@("C")" Disabled>Beijing</Radio>
<Radio RadioButton Value="@("D")" Disabled>Chengdu</Radio>
<RadioGroup Disabled @bind-Value="radioValue3">
<Radio RadioButton Value="@("A")" >Hangzhou</Radio>
<Radio RadioButton Value="@("B")" >Shanghai</Radio>
<Radio RadioButton Value="@("C")" >Beijing</Radio>
<Radio RadioButton Value="@("D")" >Chengdu</Radio>
</RadioGroup>
</div>