axios
# 请求
axios({
methed:"post",
url:"http://localhost",
header:{
'content-type':"applicationsaddfasdfaew"
},
data:{
"json":"jsondata"
}
}).then(res=>{
console.log("dsadas");
})
axios({
methed:"get",
url:"http://localhost",
header:{
'content-type':"applicationsaddfasdfaew"
},
parms:{
json:"jsondata"
}
}).then(res=>{
console.log("dsadas");
})
axios.post().then().finally()
axios.get().then().finally()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
配置
let p = axios.create(
baseURL:"dsadasd"
timeout:"2000"
)
p.post().then().finally()
1
2
3
4
5
2
3
4
5
中断
p.interceptors().request.use((config)=>{ /*config 里大概是一些header*/})
p.interceptors().respond.use((config)=>{})
1
2
2
编辑 (opens new window)
上次更新: 2024/04/16, 00:35:21