vue配置后台请求接口地址的统一前缀
请求方式使用的是axios,在main.js中添加baseURL在下面配置中加上axios.defaults.baseURL = 'http://xxxx:18081';即可Vue.use(VueAxios, axios)axios.defaults.baseURL = 'http://localhost:18081';再次发送请求时就不用带前缀了this.axios({url: '/api-ad
·
请求方式使用的是
axios
,在main.js
中添加baseURL
在下面配置中加上
axios.defaults.baseURL = 'http://xxxx:18081';
即可
Vue.use(VueAxios, axios)
axios.defaults.baseURL = 'http://localhost:18081';
再次发送请求时就不用带前缀了
this.axios(
{
url: '/api-admin/user/selectServiceOrSenderTest/1/',
method: 'GET',
data: {}
}
).then(response => {
console.log(response)
})
更多推荐
已为社区贡献17条内容
所有评论(0)