Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/crazymryan/request-funjs
- Owner: CrazyMrYan
- Created: 2020-03-11T03:27:41.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-12T07:58:24.000Z (almost 5 years ago)
- Last Synced: 2024-10-17T12:32:33.634Z (2 months ago)
- Topics: ajax, javascript, jquery, npm, reqeust, vue
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/request-funjs
- Size: 14.6 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.Get2、post请求 :
Request.Post3、批量post :
Request.PostBatch4、put请求 :
Request.Put5、delete请求
Request.Delete6、批量delete :
Request.DeleteBatch7、微信分享 :
Request.SetShare
```If you like, please give me a star :star: