diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj index d91e5121f4d..b937e44ea4b 100644 --- a/src/BootstrapBlazor/BootstrapBlazor.csproj +++ b/src/BootstrapBlazor/BootstrapBlazor.csproj @@ -1,7 +1,7 @@ - 8.1.5 + 8.1.6-beta01 diff --git a/src/BootstrapBlazor/Components/Input/BootstrapInput.razor b/src/BootstrapBlazor/Components/Input/BootstrapInput.razor index 8fd048f2946..7b9c38f900a 100644 --- a/src/BootstrapBlazor/Components/Input/BootstrapInput.razor +++ b/src/BootstrapBlazor/Components/Input/BootstrapInput.razor @@ -1,6 +1,6 @@ @namespace BootstrapBlazor.Components @typeparam TValue -@inherits BootstrapInputBase +@inherits BootstrapInputEventBase @if (IsShowLabel) { diff --git a/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.cs b/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.cs index 7c5ce7eed5d..4f2e66b5f83 100644 --- a/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.cs +++ b/src/BootstrapBlazor/Components/Input/BootstrapInput.razor.cs @@ -16,12 +16,4 @@ public partial class BootstrapInput public bool Readonly { get; set; } private string? ReadonlyString => Readonly ? "true" : null; - - /// - /// 获得/设置 是否在文本框输入值时触发 bind-value:event="oninput" 默认 false - /// - [Parameter] - public bool UseInputEvent { get; set; } = false; - - private string EventString => UseInputEvent ? "oninput" : "onchange"; } diff --git a/src/BootstrapBlazor/Components/Input/BootstrapInputEventBase.cs b/src/BootstrapBlazor/Components/Input/BootstrapInputEventBase.cs new file mode 100644 index 00000000000..d8451717c6d --- /dev/null +++ b/src/BootstrapBlazor/Components/Input/BootstrapInputEventBase.cs @@ -0,0 +1,22 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace BootstrapBlazor.Components; + +/// +/// 输入框基类 +/// +public abstract class BootstrapInputEventBase : BootstrapInputBase +{ + /// + /// 获得/设置 是否在文本框输入值时触发 bind-value:event="oninput" 默认 false + /// + [Parameter] + public bool UseInputEvent { get; set; } + + /// + /// event 字符串 + /// + protected string EventString => UseInputEvent ? "oninput" : "onchange"; +} diff --git a/src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumber.razor b/src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumber.razor index f6ffd80e85b..21c8ab4c573 100644 --- a/src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumber.razor +++ b/src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumber.razor @@ -12,7 +12,7 @@ - + @@ -20,5 +20,5 @@ } else { - + } diff --git a/src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumberBase.cs b/src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumberBase.cs index 1b7e5b5a23a..c63fe7cc1b9 100644 --- a/src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumberBase.cs +++ b/src/BootstrapBlazor/Components/InputNumber/BootstrapInputNumberBase.cs @@ -7,7 +7,7 @@ namespace BootstrapBlazor.Components; /// /// BootstrapInputNumber 基类 /// -public class BootstrapInputNumberBase : BootstrapInputBase +public class BootstrapInputNumberBase : BootstrapInputEventBase { /// /// SetParametersAsync 方法 diff --git a/src/BootstrapBlazor/Components/Slider/Slider.razor b/src/BootstrapBlazor/Components/Slider/Slider.razor index c30dd6ea4bf..4f1a5bc2ec2 100644 --- a/src/BootstrapBlazor/Components/Slider/Slider.razor +++ b/src/BootstrapBlazor/Components/Slider/Slider.razor @@ -20,5 +20,5 @@ else @code { RenderFragment RenderRange => - @; + @; } diff --git a/src/BootstrapBlazor/Components/Slider/Slider.razor.cs b/src/BootstrapBlazor/Components/Slider/Slider.razor.cs index 5c6a9f20774..4f0c6f65634 100644 --- a/src/BootstrapBlazor/Components/Slider/Slider.razor.cs +++ b/src/BootstrapBlazor/Components/Slider/Slider.razor.cs @@ -16,12 +16,6 @@ public partial class Slider .AddClassFromAttributes(AdditionalAttributes) .Build(); - /// - /// 获得/设置 是否使用 input 事件 默认为 false - /// - [Parameter] - public bool UseInputEvent { get; set; } - /// /// 获得/设置 最小值 默认为 null 未设置 /// @@ -43,8 +37,6 @@ public partial class Slider [NotNull] public TValue? Step { get; set; } - private string eventName => UseInputEvent ? "oninput" : "onchange"; - private string? MinString => Min.ToString() == "0" ? GetRangeMinString : Min.ToString(); private string? GetRangeMinString => _range?.Minimum.ToString();