File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/BootstrapBlazor/Components/Select Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,13 @@ public partial class Select<TValue> : ISelect
235235 [ NotNull ]
236236 private IStringLocalizer < Select < TValue > > ? Localizer { get ; set ; }
237237
238+ /// <summary>
239+ /// 获得/设置 <see cref="ILookupService"/> 服务实例
240+ /// </summary>
241+ [ Inject ]
242+ [ NotNull ]
243+ private ILookupService ? InjectLookupService { get ; set ; }
244+
238245 /// <summary>
239246 /// 获得 input 组件 Id 方法
240247 /// </summary>
@@ -371,13 +378,15 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
371378 private async Task < IEnumerable < SelectedItem > > GetItemsAsync ( )
372379 {
373380 IEnumerable < SelectedItem > ? items = null ;
374- if ( LookupService != null )
381+ if ( ! string . IsNullOrEmpty ( LookupServiceKey ) )
375382 {
376- items = await LookupService . GetItemsByKeyAsync ( LookupServiceKey , LookupServiceData ) ;
383+ items = await GetLookupService ( ) . GetItemsAsync ( LookupServiceKey , LookupServiceData ) ;
377384 }
378385 return items ?? [ ] ;
379386 }
380387
388+ private ILookupService GetLookupService ( ) => LookupService ?? InjectLookupService ;
389+
381390 /// <summary>
382391 /// 获得/设置 数据总条目
383392 /// </summary>
You can’t perform that action at this time.
0 commit comments