diff --git a/template/server/.gitignore b/template/server/.gitignore index 46daa72e9b7d62eb336ca89a97cee122ca843b23..f9d964519ad2cb2024bef41710eed2f2f96a682f 100644 --- a/template/server/.gitignore +++ b/template/server/.gitignore @@ -1 +1,10 @@ -template.yaml \ No newline at end of file +template.yaml + +server/handler/assets/ +server/handler/index.html + +web/node_modules +web/dist/ + +handler/index.html +handler/assets \ No newline at end of file diff --git a/template/server/handler/static.go b/template/server/handler/static.go index 0eeb2e54811733a5a3d88909fc61862c97ed84af..c93a8f53160496cfd410b4e75275a8e2330b226a 100644 --- a/template/server/handler/static.go +++ b/template/server/handler/static.go @@ -13,7 +13,7 @@ import ( func StaticRouter(router *gin.Engine) { static := router.Group("/plugin/template") { - static.Static("/static", "../web/dist/static") + static.Static("/assets", "../web/dist/assets") static.StaticFile("/", "../web/dist/index.html") // 解决页面刷新404的问题 diff --git a/template/server/handler/staticPro.go b/template/server/handler/staticPro.go index 9489c804e638cfc71ad9415469f9f4c17579a154..9f7d8d346a3f65c9c8012b797649b01735be6429 100644 --- a/template/server/handler/staticPro.go +++ b/template/server/handler/staticPro.go @@ -14,7 +14,7 @@ import ( "github.com/gin-gonic/gin" ) -//go:embed static index.html +//go:embed assets index.html var StaticFiles embed.FS func StaticRouter(router *gin.Engine) { @@ -27,7 +27,7 @@ func StaticRouter(router *gin.Engine) { mime.AddExtensionType(".js", "application/javascript") static := router.Group("/plugin/template") { - static.StaticFS("/static", http.FS(sf)) + static.StaticFS("/assets", http.FS(sf)) static.GET("/", func(c *gin.Context) { c.FileFromFS("/", http.FS(StaticFiles)) }) diff --git a/template/web/vite.config.ts b/template/web/vite.config.ts index bd0d1650c596c65719ad33753a3445759e84c3b3..72a5deaa60b51fd2ee5fad77e86385121eac3c9c 100644 --- a/template/web/vite.config.ts +++ b/template/web/vite.config.ts @@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ + base: "/plugin/template", plugins: [vue()], server: { proxy: {