public void ConfigureServices(IServiceCollection services)
{
// 省略的代码 ...
// 添加 FineUI 服务
services.AddFineUI(Configuration);
// ASP.NET Core RazorPages 支持
services.AddRazorPages().AddMvcOptions(options =>
{
// 自定义JSON模型绑定(添加到最开始的位置)
options.ModelBinderProviders.Insert(0, new FineUICore.JsonModelBinderProvider());
// 自定义RazorForms开发模式(仅在启用EnableRazorForms时有效)
options.Filters.Insert(0, new FineUICore.RazorFormsFilter());
}).AddNewtonsoftJson().AddRazorRuntimeCompilation();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// 省略的代码 ...
// 使用 FineUI 中间件(确保 UseFineUI 位于 UseEndpoints 的前面)
app.UseFineUI();
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});
}
{
"FineUI": {
"EnableRazorForms": true,
"DebugMode": true,
"Theme": "Pure_Black"
}
}
FineUI 配置节中的参数:
{
"FineUI": {
"DisplayMode": "Large",
"MobileAdaption": true,
"EnableAnimation": true
}
}