在项目根目录创建一个config文件夹主要放一些项目公共配置管理
在config文件夹下创建一个index.config.js文件
const CONFIG = {
// 开发环境配置
development: {
assetsPath: '/static', // 静态资源路径
baseUrl: '', // 后台接口请求地址
hostUrl: '', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址
weixinAppId: '' // 微信公众号appid
},
// 生产环境配置
production: {
assetsPath: '/static', // 静态资源路径
baseUrl: '', // 后台接口请求地址
hostUrl: '', // H5地址(前端运行地址)
websocketUrl: '', // websocket服务端地址
weixinAppId: '' // 微信公众号appid
}
};
export default CONFIG[process.env.NODE_ENV];