File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk.Razor" >
22
33 <PropertyGroup >
4- <Version >9.11.3-beta04 </Version >
4+ <Version >9.11.3-beta05 </Version >
55 </PropertyGroup >
66
77 <ItemGroup >
Original file line number Diff line number Diff line change @@ -133,10 +133,16 @@ protected override void OnParametersSet()
133133 SubMenuIcon ??= IconTheme . GetIconByKey ( ComponentIcons . CascaderSubMenuIcon ) ;
134134 ClearIcon ??= IconTheme . GetIconByKey ( ComponentIcons . SelectClearIcon ) ;
135135
136- Items ??= [ ] ;
137-
138136 PlaceHolder ??= Localizer [ nameof ( PlaceHolder ) ] ;
139137
138+ Items ??= [ ] ;
139+ if ( ! Items . Any ( ) )
140+ {
141+ _lastValue = string . Empty ;
142+ Value = default ;
143+ return ;
144+ }
145+
140146 if ( _lastValue != CurrentValueAsString )
141147 {
142148 _lastValue = CurrentValueAsString ;
Original file line number Diff line number Diff line change @@ -173,7 +173,16 @@ public void SetDefaultValue_Ok()
173173 pb . Add ( a => a . Value , "1" ) ;
174174 pb . Add ( a => a . ShowFullLevels , false ) ;
175175 } ) ;
176- Assert . Empty ( cut . Instance . Value ) ;
176+
177+ // 未提供数据源时 Value 赋值无效
178+ Assert . Null ( cut . Instance . Value ) ;
179+
180+ cut . SetParametersAndRender ( pb =>
181+ {
182+ pb . Add ( a => a . Items , items ) ;
183+ pb . Add ( a => a . Value , "3" ) ;
184+ pb . Add ( a => a . ShowFullLevels , false ) ;
185+ } ) ;
177186 }
178187
179188 [ Fact ]
You can’t perform that action at this time.
0 commit comments