From b282ee8273e6d59441c6694106f0de93cd339916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Sun, 10 Nov 2024 22:31:56 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=96=B0=E5=A2=9Ewxss=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs index a643c514..f1ab5ae7 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.StaticFiles; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; @@ -19,6 +20,7 @@ using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.AntiForgery; using Volo.Abp.AspNetCore.Mvc.ExceptionHandling; using Volo.Abp.AspNetCore.Serilog; +using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.Auditing; using Volo.Abp.Autofac; using Volo.Abp.Caching; @@ -277,7 +279,7 @@ namespace Yi.Abp.Web //授权 context.Services.AddAuthorization(); - + return Task.CompletedTask; } @@ -319,7 +321,18 @@ namespace Yi.Abp.Web app.UseYiApiHandlinge(); //静态资源 - app.UseStaticFiles("/api/app/wwwroot"); + app.UseStaticFiles(new StaticFileOptions + { + RequestPath = "/api/app/wwwroot", + // 可以在这里添加或修改MIME类型映射 + ContentTypeProvider = new FileExtensionContentTypeProvider + { + Mappings = + { + [".wxss"] = "text/css" + } + } + }); app.UseDefaultFiles(); app.UseDirectoryBrowser("/api/app/wwwroot");