? ActiveChanged { get; set; }
+
+ ///
+ ///
+ ///
+ ///
+ protected override void OnAfterRender(bool firstRender)
+ {
+ if (firstRender)
+ {
+ ClickItemCallback = UpdateItem;
+ ActiveChanged = UpdateItem;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected void UpdateItem(SelectItemBase item)
+ {
+ SelectedItem = item;
+ StateHasChanged();
+ }
+ }
+}
diff --git a/src/admin/Bootstrap.Admin/Components/SelectItemBase.cs b/src/admin/Bootstrap.Admin/Components/SelectItemBase.cs
new file mode 100644
index 00000000..30ce7ca4
--- /dev/null
+++ b/src/admin/Bootstrap.Admin/Components/SelectItemBase.cs
@@ -0,0 +1,55 @@
+using Bootstrap.Admin.Shared;
+using Microsoft.AspNetCore.Components;
+
+namespace Bootstrap.Admin.Components
+{
+ ///
+ ///
+ ///
+ public class SelectItemBase : ComponentBase
+ {
+ ///
+ ///
+ ///
+ [Parameter]
+ public bool Active { get; set; }
+
+ ///
+ ///
+ ///
+ [Parameter]
+ public string Text { get; set; } = "";
+
+ ///
+ ///
+ ///
+ [Parameter]
+ public string Value { get; set; } = "";
+
+ ///
+ ///
+ ///
+ [CascadingParameter]
+ public Select? Select { get; set; }
+
+ ///
+ ///
+ ///
+ ///
+ protected override void OnAfterRender(bool firstRender)
+ {
+ if (firstRender)
+ {
+ if (Active) Select?.ActiveChanged?.Invoke(this);
+ }
+ }
+
+ ///
+ ///
+ ///
+ protected void ClickItem()
+ {
+ Select?.ClickItemCallback?.Invoke(this);
+ }
+ }
+}
diff --git a/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor b/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor
index b2e906d3..344b0355 100644
--- a/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor
+++ b/src/admin/Bootstrap.Admin/Pages/Admin/Dicts.razor
@@ -13,12 +13,11 @@
-
-
+
@@ -52,7 +51,7 @@
字典标签 |
字典名称 |
字典代码 |
-
字典分类 |
+
字典类型 |
@context.Category |
@@ -128,6 +127,8 @@
[Parameter]
public int PageIndex { get; set; } = 1;
+ protected Select? DictCate { get; set; }
+
protected int PageItem { get; set; } = 20;
protected Pagination? Pagination { get; set; }
@@ -152,6 +153,7 @@
protected void Query(int pageIndex)
{
var data = DataAccess.DictHelper.RetrieveDicts();
+ if (!string.IsNullOrEmpty(DictCate?.SelectedItem?.Value)) data = data.Where(d => d.Define.ToString() == DictCate?.SelectedItem?.Value);
ItemsCount = data.Count();
Items = data.Skip((pageIndex - 1) * PageItem).Take(PageItem);
PageCount = (int)Math.Ceiling(data.Count() * 1.0d / PageItem);
diff --git a/src/admin/Bootstrap.Admin/Pages/_Host.cshtml b/src/admin/Bootstrap.Admin/Pages/_Host.cshtml
index 6e7260ea..a52ec7fb 100644
--- a/src/admin/Bootstrap.Admin/Pages/_Host.cshtml
+++ b/src/admin/Bootstrap.Admin/Pages/_Host.cshtml
@@ -33,6 +33,7 @@
+
diff --git a/src/admin/Bootstrap.Admin/Shared/Select.razor b/src/admin/Bootstrap.Admin/Shared/Select.razor
new file mode 100644
index 00000000..b316cd3e
--- /dev/null
+++ b/src/admin/Bootstrap.Admin/Shared/Select.razor
@@ -0,0 +1,16 @@
+@inherits SelectBase
+
+
+
+
+
+
+
+
+@code {
+
+}
diff --git a/src/admin/Bootstrap.Admin/Shared/SelectItem.razor b/src/admin/Bootstrap.Admin/Shared/SelectItem.razor
new file mode 100644
index 00000000..ff0a0346
--- /dev/null
+++ b/src/admin/Bootstrap.Admin/Shared/SelectItem.razor
@@ -0,0 +1,6 @@
+@inherits SelectItemBase
+
+@Text
+
+@code {
+}