Files
martial-mini/config/api.config.js
2025-12-12 17:29:38 +08:00

40 lines
715 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* API配置文件
* 统一管理不同环境的API地址
*/
// 开发环境配置
const development = {
// 使用代理路径vue.config.js会将/api代理到http://localhost:8123
baseURL: '/api',
timeout: 30000
}
// 测试环境配置
const test = {
baseURL: 'http://test-api.yourdomain.com',
timeout: 30000
}
// 生产环境配置
const production = {
baseURL: 'https://api.yourdomain.com',
timeout: 30000
}
// 根据 process.env.NODE_ENV 自动切换环境
// uniapp 编译时会自动注入 NODE_ENV
const env = process.env.NODE_ENV || 'development'
const config = {
development,
test,
production
}
// 导出当前环境的配置
export default {
...config[env],
env
}