Vue中使用axios
需要先安装axios和vue-axios
shell
yarm add axios vue-axios
yarm add axios vue-axios
typescript
import axios from "axios";
import VueAxios from 'vue-axios'
import qs from 'qs';
axios.defaults.baseURL = config.server_url;
axios.defaults.transformRequest = [function (data) {
return qs.stringify(data);
}];
Vue.use(VueAxios, axios)
import axios from "axios";
import VueAxios from 'vue-axios'
import qs from 'qs';
axios.defaults.baseURL = config.server_url;
axios.defaults.transformRequest = [function (data) {
return qs.stringify(data);
}];
Vue.use(VueAxios, axios)
我的博客即将同步至腾讯云+社区,邀请大家一同入驻:https://cloud.tencent.com/developer/support-plan?invite_code=2d1bxyag1gcgk