axios如何在请求头添加参数
直接看代码import axios from "axios"axios.get(' https://domain-name/api/qualification/query', {params: {mobile: 15712345678,},headers: {'activityId': 11}}).then( (res) => {console.log('成功', res)}).catch(
·
直接看代码
import axios from "axios"
axios.get(' https://domain-name/api/qualification/query', {
params: {
mobile: 15712345678,
},
headers: {
'activityId': 11
}
})
.then( (res) => {
console.log('成功', res)
})
.catch( (err) => {
console.log('报错提示', err)
})
axios.post(' https://domain-name/api/qualification/update', {
data: {
mobile: 15712345678,
},
headers: {
'activityId': 11
}
})
.then( (res) => {
console.log('成功', res)
})
.catch( (err) => {
console.log('报错提示', err)
})
this.$axios({
method:'',
url:'',
headers: {
'Content-Type': 'application/json', //设置请求头请求格式为JSON
'access_token': this.token //设置token
},
params:{}
}).then((response)=>{})
更多推荐
已为社区贡献3条内容
所有评论(0)