|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the Apache 2.0 License |
| 3 | +// See the LICENSE file in the project root for more information. |
| 4 | +// Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone |
| 5 | + |
| 6 | +namespace BootstrapBlazor.Server.Components.Samples; |
| 7 | + |
| 8 | +/// <summary> |
| 9 | +/// Toolbar 组件示例代码 |
| 10 | +/// </summary> |
| 11 | +public partial class Toolbars |
| 12 | +{ |
| 13 | + private readonly List<SelectedItem> _items1 = []; |
| 14 | + private string _item1 = "1,2"; |
| 15 | + |
| 16 | + private readonly List<SelectedItem> _items2 = []; |
| 17 | + private string _item2 = "1"; |
| 18 | + |
| 19 | + private readonly List<SelectedItem> _items3 = []; |
| 20 | + private string _item3 = "1"; |
| 21 | + |
| 22 | + /// <summary> |
| 23 | + /// <inheritdoc/> |
| 24 | + /// </summary> |
| 25 | + protected override void OnInitialized() |
| 26 | + { |
| 27 | + base.OnInitialized(); |
| 28 | + |
| 29 | + _items1.Add(new SelectedItem("1", "Text1")); |
| 30 | + _items1.Add(new SelectedItem("2", "Text2")); |
| 31 | + _items1.Add(new SelectedItem("3", "Text3")); |
| 32 | + |
| 33 | + _items2.Add(new SelectedItem("1", "Text1")); |
| 34 | + _items2.Add(new SelectedItem("2", "Text2")); |
| 35 | + _items2.Add(new SelectedItem("3", "Text3")); |
| 36 | + |
| 37 | + _items3.Add(new SelectedItem("1", "Text1")); |
| 38 | + _items3.Add(new SelectedItem("2", "Text2")); |
| 39 | + _items3.Add(new SelectedItem("3", "Text3")); |
| 40 | + } |
| 41 | + |
| 42 | + private static string GetIconByItem(string v) => v switch |
| 43 | + { |
| 44 | + "1" => "fa-solid fa-align-left", |
| 45 | + "2" => "fa-solid fa-align-center", |
| 46 | + _ => "fa-solid fa-align-right" |
| 47 | + }; |
| 48 | + |
| 49 | + private static string GetRadioIconByItem(string v) => v switch |
| 50 | + { |
| 51 | + "1" => "fa-solid fa-bold", |
| 52 | + "2" => "fa-solid fa-italic", |
| 53 | + _ => "fa-solid fa-font" |
| 54 | + }; |
| 55 | +} |
0 commit comments