Przeglądaj źródła

修改 模块配置

钟志权 1 rok temu
rodzic
commit
5d0aa5ed54
1 zmienionych plików z 2 dodań i 3 usunięć
  1. 2 3
      knife4gin/knife4gin.go

+ 2 - 3
knife4gin/knife4gin.go

@@ -10,7 +10,7 @@ import (
 	"strings"
 )
 
-//go:embed front
+//go:embed front/
 var front embed.FS
 
 type Option struct {
@@ -50,8 +50,7 @@ func Handler(option *Option) gin.HandlerFunc {
 		case docJsonPath:
 			writeDocJson(c, docJson)
 		default:
-			//filePath := strings.ReplaceAll(c.Request.RequestURI, option.RelativePath, "")
-			filePath := strings.TrimPrefix(c.Request.RequestURI, option.RelativePath)
+			filePath := "front" + strings.TrimPrefix(c.Request.RequestURI, option.RelativePath)
 			c.FileFromFS(filePath, http.FS(front))
 		}
 	}