diff --git a/src/Masa.Blazor/Components/Input/MInput.razor.cs b/src/Masa.Blazor/Components/Input/MInput.razor.cs index 3fbf5b2ea8..b98ff967a1 100644 --- a/src/Masa.Blazor/Components/Input/MInput.razor.cs +++ b/src/Masa.Blazor/Components/Input/MInput.razor.cs @@ -11,7 +11,7 @@ public partial class MInput : MasaComponentBase, IThemeable, IFilterInpu [CascadingParameter(Name = "AppIsDark")] protected bool AppIsDark { get; set; } - [Parameter] public virtual string? Color { get; set; } + [Parameter][MasaApiParameter("primary")] public string? Color { get; set; } = "primary"; [Parameter] public string? BackgroundColor { get; set; } @@ -224,7 +224,7 @@ public void StateHasChangedForJsInvokable() #endregion - public virtual string? ComputedColor => IsDisabled ? null : Color ?? (IsDark && !AppIsDark ? "white" : "black"); + public virtual string? ComputedColor => IsDisabled ? null : Color; public virtual bool HasColor => false; diff --git a/src/Masa.Blazor/Components/Slider/MSliderBase.razor.cs b/src/Masa.Blazor/Components/Slider/MSliderBase.razor.cs index b7ca792982..de73631069 100644 --- a/src/Masa.Blazor/Components/Slider/MSliderBase.razor.cs +++ b/src/Masa.Blazor/Components/Slider/MSliderBase.razor.cs @@ -28,8 +28,6 @@ public partial class MSliderBase : MInput, IOutsideCli [Parameter] [MasaApiParameter(false)] public StringBoolean Ticks { get; set; } = false; - [Parameter] [MasaApiParameter("primary")] public override string? Color { get; set; } = "primary"; - [Parameter] public string? TrackColor { get; set; } [Parameter] public string? TrackFillColor { get; set; } diff --git a/src/Masa.Blazor/Components/TextField/MTextField.razor.cs b/src/Masa.Blazor/Components/TextField/MTextField.razor.cs index 2aaec3c9eb..ef2a98d02a 100644 --- a/src/Masa.Blazor/Components/TextField/MTextField.razor.cs +++ b/src/Masa.Blazor/Components/TextField/MTextField.razor.cs @@ -181,18 +181,7 @@ public virtual bool Outlined public bool HasCounter => Counter != false && Counter != null; - public override string? ComputedColor - { - get - { - if (!SoloInverted || !IsFocused) - { - return base.ComputedColor; - } - - return Color ?? "primary"; - } - } + public override string? ComputedColor => !SoloInverted || !IsFocused ? base.ComputedColor : Color; public override bool HasColor => IsFocused;