import axios from 'axios' const Post = axios.create({ baseURL: '/api', method: 'post', headers: { 'Content-Type': 'application/x-www-form-urlencoded'//'application/json' }, transformRequest: [function (data) { let ret = '' for (let key in data) { ret += encodeURIComponent(key) + '=' + encodeURIComponent(data[key]) + '&' } return ret }] })
Post({ data: { usrname, pwd }, url: "/login" }) }.then((res)=>{}).catch((error)=>{})
json:
const apiBaseURL = "https://xxxxxx/apis/v1/bind"
const config = {baseURL:apiBaseURL,headers: {'Content-Type': 'application/json',}}
function Search(data){
return axios.post("/search",JSON.stringify(data), config)
}