var HTTP = axios.create({
baseURL: 'https://..../', // 这是基础url
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
transformRequest: [
function(data) {
// Do whatever you want to transform the data
let ret = ''
for (let it in res) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}
]
})
HTTP.post('cms/user/login', { name: 'admin', password: 123456 }).then(
function(response) {
console.log(response.data)
}
)
Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight respon
最新推荐文章于 2023-12-05 20:22:23 发布