http.jsconst service = axios.create({
baseUrl: '//apixh-beta.17win.com', // window.xhHost['solar-api'], // 'apixh-beta.17win.com',
timeout: 5000
})
service.interceptors.request.use( config => { //...
}, err => { //...
}
)// ...export default serviceapi.jsimport Http from '@/http'export default {
getData (params) { console.log('get my cert...') return Http({url:'/api/XXX', method: 'get', params})
}}home.js import Service from '@/api.js'
Service.getMyCert({}).then(response => {}) // 这里request URL: http://localhost:3000/api/xxxaxios.create设置了baseUrl,但是实际请求的baseUrl还是localhost:3000/api/xxx
添加回答
举报
0/150
提交
取消