vue.config.js 添加配置
var _Ip='线上地址'
module.exports = {
devServer: {
proxy: {
'/productData': {
target: _Ip,
changeOrigin: true,
pathRewrite: {
'^/productData': '/productData'
}
}
}
},
}
接口地址配置
var url1 = '线上地址'
var url2 = 'http://localhost:8080'
var ip = process.env.NODE_ENV === 'production' ? url1 : url2