mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-05 05:29:47 +08:00
!3609 fix(#I65MRC): do not update Value when input value on search box on Select component
* Merge branch 'main' into fix/select * fix: 修复 Select 下拉框输入搜索条件时 Value 直接改变问题
This commit is contained in:
parent
9b153e4330
commit
d9d8ce996d
@ -163,22 +163,22 @@ public partial class Select<TValue> : ISelect
|
||||
{
|
||||
DataSource = Items.ToList();
|
||||
DataSource.AddRange(Children);
|
||||
|
||||
SelectedItem = DataSource.FirstOrDefault(i => i.Value.Equals(CurrentValueAsString, StringComparison))
|
||||
?? DataSource.FirstOrDefault(i => i.Active)
|
||||
?? DataSource.FirstOrDefault();
|
||||
|
||||
// 检查 Value 值是否在候选项中存在
|
||||
// Value 不等于 选中值即不存在
|
||||
if (!string.IsNullOrEmpty(SelectedItem?.Value) && CurrentValueAsString != SelectedItem.Value)
|
||||
{
|
||||
_ = ItemChanged(SelectedItem);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DataSource = OnSearchTextChanged(SearchText).ToList();
|
||||
}
|
||||
|
||||
SelectedItem = DataSource.FirstOrDefault(i => i.Value.Equals(CurrentValueAsString, StringComparison))
|
||||
?? DataSource.FirstOrDefault(i => i.Active)
|
||||
?? DataSource.FirstOrDefault();
|
||||
|
||||
// 检查 Value 值是否在候选项中存在
|
||||
// Value 不等于 选中值即不存在
|
||||
if (!string.IsNullOrEmpty(SelectedItem?.Value) && CurrentValueAsString != SelectedItem.Value)
|
||||
{
|
||||
_ = ItemChanged(SelectedItem);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user