几秒 读完 (大约 88 个字)
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
| 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); });
|