1.0.6 • Published 5 years ago

yjf0-fetch v1.0.6

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

yjf0-fetch polyfilt

fetchy)函数用于请求接口,其中包含fetch.get() get .post() / get .push() / fetch.delete1

installation

npm yjf0-fetch --save
const fetch = require('yjf0-fetch');

Usage

有关此polyfill支持的更全面的API引用,请参考 https://github.com/yjf/yjf0-fetch

Importing

导入将自动填充窗口。获取和相关api:

import 'yjf0-fetch';

GET·JSON

fetch.get("http://jsonplaceholder.typicode.com/users").then(users=>{
     console.log(users);
  })

POST·JSON

 var users={
     name:'name',
     age:'age'
 };
 fetch.post('/users',users).then(res=>{
     console.log(res));
 })

PUT·JSON

 var users={
     name:'name',
     age:'age'
 };
 fetch.put('/users/:id',users).then(res=>{
     console.log(res));
 })

DELETE·JSON

 var users={
     name:'name',
     age:'age'
 };
 fetch.put('/users/:id',users).then(res=>{
     console.log(res));
 })
1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.0

5 years ago