feat: 增加 Dummy 示例页面
This commit is contained in:
parent
7a95ddc039
commit
f7b2c059ef
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
|
||||
// Website: https://admin.blazor.zone
|
||||
|
||||
using BootstrapClient.DataAccess.Models;
|
||||
using BootstrapClient.Web.Core;
|
||||
using PetaPoco;
|
||||
|
||||
|
@ -19,4 +20,17 @@ internal class DummyService : IDummy
|
|||
{
|
||||
Database = db.Create();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DummyEntity> GetAll()
|
||||
{
|
||||
return new List<DummyEntity>()
|
||||
{
|
||||
new() { Id= "1", Name ="Dummy1" },
|
||||
new() { Id= "2", Name ="Dummy2" }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
@using BootstrapClient.Web.Shared.Components
|
||||
@page "/dummy"
|
||||
|
||||
<AdminTable TItem="BootstrapClient.DataAccess.Models.DummyEntity" OnQueryAsync="OnQueryAsync">
|
||||
<TableColumns>
|
||||
<TableColumn @bind-Field="context.Id"></TableColumn>
|
||||
<TableColumn @bind-Field="context.Name"></TableColumn>
|
||||
</TableColumns>
|
||||
</AdminTable>
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
|
||||
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
|
||||
// Website: https://admin.blazor.zone
|
||||
|
||||
using BootstrapClient.DataAccess.Models;
|
||||
using BootstrapClient.Web.Core;
|
||||
|
||||
namespace BootstrapClient.Web.Shared.Pages;
|
||||
|
||||
public partial class Dummy
|
||||
{
|
||||
[Inject]
|
||||
[NotNull]
|
||||
private IDummy? DummyService { get; set; }
|
||||
|
||||
private Task<QueryData<DummyEntity>> OnQueryAsync(QueryPageOptions options)
|
||||
{
|
||||
var items = DummyService.GetAll();
|
||||
var ret = new QueryData<DummyEntity>()
|
||||
{
|
||||
Items = items
|
||||
};
|
||||
return Task.FromResult(ret);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
|
||||
// Website: https://admin.blazor.zone
|
||||
|
||||
using BootstrapClient.DataAccess.Models;
|
||||
|
||||
namespace BootstrapClient.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
|
@ -9,4 +11,9 @@ namespace BootstrapClient.Web.Core;
|
|||
/// </summary>
|
||||
public interface IDummy
|
||||
{
|
||||
/// <summary>
|
||||
/// 获得 全部数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
List<DummyEntity> GetAll();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
|
||||
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
|
||||
// Website: https://admin.blazor.zone
|
||||
|
||||
namespace BootstrapClient.DataAccess.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 数据库实体类
|
||||
/// </summary>
|
||||
public class DummyEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 获得/设置 Id
|
||||
/// </summary>
|
||||
public string? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 Name
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
}
|
Loading…
Reference in New Issue