FengChaoYu 1 semana atrás
pai
commit
2312c6e534
2 arquivos alterados com 9 adições e 1 exclusões
  1. 5 0
      .env.development
  2. 4 1
      vite.config.js

+ 5 - 0
.env.development

@@ -3,3 +3,8 @@ ENV = 'development'
 VITE_APP_BASE_API = 'https://jiasm.zfire.top/overseas-miniapp'
 
 VITE_APP_BASE_OSS = 'https://jiasm.zfire.top/overseas-api/img/get?key='
+
+#VITE_APP_BASE_API = 'http://localhost:33004/overseas-miniapp'
+
+#VITE_APP_BASE_OSS = 'http://localhost:33004/overseas-miniapp/img/get?key='
+

+ 4 - 1
vite.config.js

@@ -7,7 +7,10 @@ import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
 export default defineConfig(({ mode }) => {
   const isProduction = mode === 'production'
   return {
-    base: isProduction ? './' : '/',
+    // 根据环境设置不同的base路径
+    // 开发环境使用根路径'/',方便本地开发访问
+    // 生产环境使用'/overseas-mall/',与nginx配置匹配
+    base: isProduction ? '/overseas-mall/' : '/',
     plugins: [
       vue(),
       Components({