using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using BlazorApp;
using BlazorApp.Shared;
using BootstrapBlazor.Components;
using BlazorApp.Data;
using System.Diagnostics.CodeAnalysis;
namespace BlazorApp.Pages
{
public partial class VirtualScrolling
{
[NotNull]
private List<Foo>? DBList { get; set; }
[NotNull]
private int PageCount { get; set; }
/// <summary>
/// OnInitialized
/// </summary>
protected override void OnInitialized()
{
base.OnInitialized();
//模拟数据库
DBList = Foo.GenerateFoo(10000);
}
private async Task<QueryData<Foo>> OnQueryAsync(QueryPageOptions options)
{
//控制加载数据,避免卡死
await Task.Delay(200);
//从数据库读取分页的总数
int count = DBList.Count;
//分页获取
var items = DBList.Skip(options.StartIndex).Take(options.PageItems);
PageCount = options.PageItems;
//异步方法需要主动调用这个方法,告诉前台Blazor的状态已经改变
StateHasChanged();
return new QueryData<Foo>()
{
Items = items,
TotalCount = count
};
}
}
}
在计算机使用过程中,我们可能会遇到各种问题,其中之一就是msvcr120.dll缺失。msvcr120.dll是Microsoft Visual C Redistributable的一个组件,它包含了运行许多基于Windows的应用程序所必需的库文件。当这个文件丢失或损坏时,可能会…