diff --git a/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs b/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs index 660a4bdc98f6086127b5925295176d472566f381..2e1aa40c75692095907c095e0a44aeeb8642a7b6 100644 --- a/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs +++ b/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs @@ -3,6 +3,7 @@ // Website: https://www.blazor.zone or https://argozhang.github.io/ using Microsoft.AspNetCore.Components; +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; namespace BootstrapBlazor.Components @@ -30,6 +31,23 @@ namespace BootstrapBlazor.Components .AddClassFromAttributes(AdditionalAttributes) .Build(); + /// + /// OnParametersSet 方法 + /// + protected override void OnParametersSet() + { + base.OnParametersSet(); + + var ipSegments = CurrentValueAsString.SpanSplit(".", System.StringSplitOptions.RemoveEmptyEntries); + if (ipSegments.Count == 4) + { + Value1 = ipSegments[0]; + Value2 = ipSegments[1]; + Value3 = ipSegments[2]; + Value4 = ipSegments[3]; + } + } + /// /// ///