import axios from 'axios'import Qs from 'Qs'let http = axios.create({ baseURL: 'http://127.0.0.1/netdisk/public/', timeout: 10000, transformRequest: [function (data) { // Do whatever you want to transform the data return Qs.stringify(data) }]})Vue.use(http)Vue.prototype.$http = http也就是说只要在main.js中不把baseURL: 'http://127.0.0.1/netdisk/public/',这行代码注释,网页打开就白屏,控制台报错Uncaught TypeError: Cannot read property 'replace' of undefined,但是Webpack打包无任何错误,这是怎么回事?因为我上线之后必须改接口地址,我不想一个一个去组件里面修改,所以必须想办法解决这个问题,谢谢各位了!
添加回答
举报
0/150
提交
取消