//user对象 let user = JSON.stringify({ userAccountNumber: own.userName, userPassword: own.userPassword }); //后台数据库验证 axios.post(url, user,{ headers: { "Content-Type": "application/json;charset=utf-8" //头部信息 } }) .then(function(response) { }) .catch(function(error) { console.log(error); });
语法为:axios.post(url,data,{.....}) 错误语法:axios.post(url,{ headers:{.......}, params:{data} //数据放这里是错误的,后台无法得到对象 })
基本语法:
axios.request(config)
axios.get(url[, config])
axios.delete(url[, config])
axios.head(url[, config])
axios.post(url[, data[, config]])
axios.put(url[, data[, config]])
axios.patch(url[, data[, config]])
中文文档:https://www.kancloud.cn/yunye/axios/234845