【发布时间】:2018-10-20 16:53:48
【问题描述】:
我如何知道 Vue.js 环境是开发环境还是生产环境?
在我的AxiosConfig 的config.js:
AxiosConfig:{
baseURL:dev.NODE_ENV.BASE_API,
responseType: "json",
withCredentials: true,
...
你在里面看到BASE_API:
有dev.NODE_ENV的定义:
dev.NODE_ENV = {
BASE_API: 'http://localhost:8000',
APP_ORIGIN: 'http://103.20.32.16:8000/'
}
如何检查环境是开发环境还是生产环境?
然后在AxiosConfigconfig.js 中我可以使用判断,当npm run build I will not need to change thebaseURL` 时。
【问题讨论】:
标签: javascript vue.js