mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-11-30 11:08:14 +08:00
fix(module: radio): disabled in radio group doesn't work (#503)
This commit is contained in:
parent
9b0f95ef3a
commit
81cce2a2d5
@ -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);
|
||||
|
@ -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';
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user