-
Notifications
You must be signed in to change notification settings - Fork 1
Home
reco_luan edited this page Dec 7, 2018
·
11 revisions
Fetch for Browser 中文文档
$ npm isntall reco-fetchimport recoFetch from 'reco-fetch'
/**
* @param url (String) API URL
* @param option (Object) Parameter object,incloud:
* method(Request method, do not fill in the default 'get')
* headers(Set request header, optional)
* data(Request parameters, all request methods apply)
* timeout(Request timeout, default 10 seconds)
*/
recoFetch(url, {
method: 'post',
headers: {},
timeout: 1000,
data: {
id: 1,
value: 2
}
}). then(res => {
console.log(res)
}).catch(err => {
console.log(err)
})