## 安裝
使用 npm:
~~~
$ npm install axios
~~~
使用 bower:
~~~
$ bower install axios
~~~
使用 cdn:
~~~
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
~~~
## Example
執行`GET`請求
~~~
// 為給定 ID 的 user 創建請求
axios.get('/user?ID=12345')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
// 可選地,上面的請求可以這樣做
axios.get('/user', {
params: {
ID: 12345
}
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
~~~
執行`POST`請求
~~~
axios.post('/user', {
firstName: 'Fred',
lastName: 'Flintstone'
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
~~~
執行多個并發請求
~~~
function getUserAccount() {
return axios.get('/user/12345');
}
function getUserPermissions() {
return axios.get('/user/12345/permissions');
}
axios.all([getUserAccount(), getUserPermissions()])
.then(axios.spread(function (acct, perms) {
// 兩個請求現在都執行完成
}));
~~~
## axios API
可以通過向`axios`傳遞相關配置來創建請求
##### axios(config)
~~~
// 發送 POST 請求
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
});
~~~
- 湖北速建時代平
- 后臺功能簡介
- 網站配置管理
- 欄目管理
- 文檔管理
- 權限管理
- vue如何使用api使用
- vue安裝
- vue設置跨域
- 使用Axios請求數據
- Axios在vue中配置
- 封裝Axios請求使用方式
- 模塊封裝引用
- 安裝Element
- 速建速度cms操作指南
- 如何創建欄目
- 普通圖文發文操作
- 文章外部跳轉
- 發布圖片集
- 視頻發布
- 文章審核
- 如何發布英文文章
- 首頁頭部圖片如何更換,二級頁面中的大圖如何修改
- 網站備份
- oss配置
- api接口使用
- 第1章獲取網站配置
- 第2章獲取頭部導航
- 第3章獲取底部導航
- 第4章獲取文章列表
- 第5章 獲取sign簽名
- 第6章 文章檢索
- 第7章獲取當前欄目詳情及子欄目