@code { private DynamicComponent BuildDynamicComponent() { return DynamicComponent.CreateComponent(new KeyValuePair[] { new KeyValuePair(nameof(Badge.Color), Color.Danger), new KeyValuePair(nameof(Badge.IsPill), true), new KeyValuePair(nameof(Badge.ChildContent), new RenderFragment(builder => { var index = 0; builder.AddContent(index++, "10"); })) }); } private IEnumerable WidgetIconSideMenuItems { get; set; } = Enumerable.Empty(); private IEnumerable GetWidgetIconSideMenuItems() { var ret = new List { new MenuItem() { Text = "系统设置", Icon = "fa fa-fw fa-gears" }, new MenuItem() { Text = "权限设置", Icon = "fa fa-fw fa-users" }, new MenuItem() { Text = "日志设置", IsActive = true, Icon = "fa fa-fw fa-database", Component = BuildDynamicComponent() } }; ret[0].AddItem(new MenuItem() { Text = "网站设置", Icon = "fa fa-fw fa-fa" }); ret[0].AddItem(new MenuItem() { Text = "任务设置", Icon = "fa fa-fw fa-tasks" }); ret[1].AddItem(new MenuItem() { Text = "用户设置", Icon = "fa fa-fw fa-user" }); ret[1].AddItem(new MenuItem() { Text = "菜单设置", Icon = "fa fa-fw fa-dashboard" }); ret[1].AddItem(new MenuItem() { Text = "角色设置", Icon = "fa fa-fw fa-sitemap" }); ret[2].AddItem(new MenuItem() { Text = "访问日志", Icon = "fa fa-fw fa-bars" }); ret[2].AddItem(new MenuItem() { Text = "登录日志", Icon = "fa fa-fw fa-user-circle-o" }); ret[2].AddItem(new MenuItem() { Text = "操作日志", Icon = "fa fa-fw fa-edit", Component = BuildDynamicComponent() }); return ret; } ///
/// OnInitialized 方法 ///
protected override void OnInitialized() { base.OnInitialized(); WidgetIconSideMenuItems = GetWidgetIconSideMenuItems(); } }