axios

axios

1
2
3
4
5
6
7
8
9
10
11
12
13
14
axios({
method: 'post',
url: 'xxxxxx',
data: {
a: 'data1',
b: 'data2'
}
})
.then(function(response) {
console.log(response) //请求成功
})
.catch(function(error) {
console.log(error) //请求失败
})

执行 GET 请求

1
2
3
4
5
6
7
8
9
10
11
12
13
// 为给定 ID 的 user 创建请求
axios
.get('/user', {
params: {
ID: 12345
}
})
.then(function(response) {
console.log(response)
})
.catch(function(error) {
console.log(error)
})
1
2
3
4
5
6
7
8
9
10
11
### 执行 POST 请求

axios.post('/user', {
ID: '1234'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
You forgot to set the qrcode for Alipay. Please set it in _config.yml.
You forgot to set the qrcode for Wechat. Please set it in _config.yml.
You forgot to set the business and currency_code for Paypal. Please set it in _config.yml.
You forgot to set the url Patreon. Please set it in _config.yml.
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×