赞
踩
axios(config) 用于直接发送请求
- export interface AxiosInstance extends Axios {
- (config: AxiosRequestConfig): AxiosPromise;
- }
- axios({
- method: 'post',
- url: '/user/12345',
- data: {
- firstName: 'Fred',
- lastName: 'Flintstone'
- }
- });
- const { default: axios } = require("axios");
- const fs = require('fs')
-
- axios({
- method: 'get',
- url: 'http://www.baidu.com',
- responseType: 'stream'
- }).then(function (response) {
- response.data.pipe(fs.createWriteStream('baidu.html'))
- });
重载方法,把 url参数单独提出来
- export interface AxiosInstance extends Axios {
- (url: string, config?: AxiosRequestConfig): AxiosPromise;
- }
还有以下请求方法
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。