axios封装
import axios from 'axios'; const http_url = "https://xxx.xxx.com" // get请求 export function getRequest(url, sendData) { return new Promise((resolve, reject) => { axios.get(http_url + url, {params: sendData}).then(res => { resolve(res.data); }).catch(error => { reject(error); }) }) } // post请求 export function postRequest(url, sendData) { return new Promise((resolve, reject) => { axios.post(http_url + url, sendData).then(res => { resolve(res.data); }).catch(error => { reject(error); }) }) }