From 5dc64da214ff0d5678fa4a52e56b4ffa556fc9ed Mon Sep 17 00:00:00 2001 From: coward Date: Fri, 24 May 2024 17:31:20 +0800 Subject: [PATCH] :art: --- .env.production | 4 ++-- app/static.go | 6 ++++++ src/config/index.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 app/static.go diff --git a/.env.production b/.env.production index 84e6086..beb1bd4 100644 --- a/.env.production +++ b/.env.production @@ -1,5 +1,5 @@ # 线上环境平台打包路径 -VITE_PUBLIC_PATH = / +VITE_PUBLIC_PATH = /web # 线上环境路由历史模式(Hash模式传"hash"、HTML5模式传"h5"、Hash模式带base参数传"hash,base参数"、HTML5模式带base参数传"h5,base参数") VITE_ROUTER_HISTORY = "hash" @@ -10,4 +10,4 @@ VITE_CDN = false # 是否启用gzip压缩或brotli压缩(分两种情况,删除原始文件和不删除原始文件) # 压缩时不删除原始文件的配置:gzip、brotli、both(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认) # 压缩时删除原始文件的配置:gzip-clear、brotli-clear、both-clear(同时开启 gzip 与 brotli 压缩)、none(不开启压缩,默认) -VITE_COMPRESSION = "none" \ No newline at end of file +VITE_COMPRESSION = "both" diff --git a/app/static.go b/app/static.go new file mode 100644 index 0000000..3b49155 --- /dev/null +++ b/app/static.go @@ -0,0 +1,6 @@ +package web + +import "embed" + +//go:embed index.html logo.svg favicon.ico platform-config.json public/platform-config.json static assets +var Static embed.FS diff --git a/src/config/index.ts b/src/config/index.ts index c81d1c4..3294b73 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -31,7 +31,7 @@ export const getPlatformConfig = async (app: App): Promise => { app.config.globalProperties.$config = getConfig(); return axios({ method: "get", - url: `${VITE_PUBLIC_PATH}platform-config.json` + url: `${VITE_PUBLIC_PATH}/platform-config.json` }) .then(({ data: config }) => { let $config = app.config.globalProperties.$config;