diff --git a/src/services/api.js b/src/services/api.js index 3ffd626..feed8ba 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -2,15 +2,16 @@ import axios from 'axios' // 根据环境变量确定基础URL const getBaseURL = () => { - const appEnv = import.meta.env.VUE_APP_ENV || 'local' - switch (appEnv) { - case 'dev': - return 'https://api-dev.beefast.co' - case 'prd': - return 'https://api.beefast.co' - default: - return 'http://localhost:8000' - } + // 从环境变量 APP_ENV 获取当前的环境 + const appEnv = process.env.APP_ENV || 'local' + switch (appEnv) { + case 'dev': + return 'https://api-dev.beefast.co' + case 'prd': + return 'https://api.beefast.co' + default: + return 'http://localhost:8000' + } } // 创建 axios 实例