Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crazymryan/request-funjs

request-funjs是对$Ajax的各种请求封装成一个简洁的函数,便捷开始,提高效率,比如 Request.Get 、Request.Post、 Request.Delete Ajax request JavaScript jQuery
https://github.com/crazymryan/request-funjs

ajax javascript jquery npm reqeust vue

Last synced: about 2 months ago
JSON representation

request-funjs是对$Ajax的各种请求封装成一个简洁的函数,便捷开始,提高效率,比如 Request.Get 、Request.Post、 Request.Delete Ajax request JavaScript jQuery

Awesome Lists containing this project

README

        

request-funjs

![](https://img.shields.io/badge/%20downloads-254/week-brightgreen.svg)
![](https://img.shields.io/npm/l/request-funjs.svg)
![](https://img.shields.io/github/stars/CrazyMrYan/request-funjs?style=social.svg)

# 快速上手

## 安装

```shell
npm install request-funjs
```

### 全局注册(在main.js文件里注册)

```javascript
import Request from 'request-funjs';
Vue.prototype.Request = Request;
//在这里需要声明一个 host 变量,作为请求的主机名称
Request.host = 'https://www.baidu.com'
```

### 局部注册(在你所使用的vue里注册)

```javascript
import Request from 'request-funjs';
//在这里需要声明一个 host 变量,作为请求的主机名称
this.Request.host = 'https://www.baidu.com'
```

## 例子

```javascript
this.Request.Get("api/list",this.params,
res => {
console.log(res);
},
err => {
console.log(err);
})
```

#### 目录

```javascript
1、get请求 :
Request.Get

2、post请求 :
Request.Post

3、批量post :
Request.PostBatch

4、put请求 :
Request.Put

5、delete请求
Request.Delete

6、批量delete :
Request.DeleteBatch

7、微信分享 :
Request.SetShare
```

If you like, please give me a star :star: