import getConfig from '../../../../env.js' // 接口前缀
let phoneApi; // 接口地址获取
if (process.env.NODE_ENV == "development") {
phoneApi = getConfig.development.PHONE_API;
} else {
phoneApi = getConfig.production.PHONE_API;
}
复制
- env.js文件内容
module.exports = {
development: {
PHONE_API: 'http://192.....:3210',
PORT: 3000,
VERSION: '0.0.1',
MODE: 'development',
NODE_ENV: 'production'
},
production: {
PHONE_API: 'http://........com',
PORT: 3000,
VERSION: '0.0.1',
MODE: 'production',
NODE_ENV: 'production'
}
}
复制