# vue-yp-http

> 基于axios使用在vue上的HTTP组件，根据YP业务二次封装。

Latest version **1.3.4** (published 2025-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install vue-yp-http
pnpm add vue-yp-http
yarn add vue-yp-http
bun add vue-yp-http
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.3.4 |
| Published | 2025-11-17 |
| First published | 2018-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >= 6.0.0 |
| Dependencies | 1 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 (+24 in 1 direct dependencies) |
| Install scripts | no |
| Author | PandaJ |
| Maintainers | pandaj |
| Keywords | vue, axios, http |

## Links

- npm: https://www.npmjs.com/package/vue-yp-http
- Homepage: https://github.com/pandajk/vue-yp-http
- npm.io page: https://npm.io/package/vue-yp-http

## Dependencies (1)

- [axios](https://npm.io/package/axios.md) ^0.18.0

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 1.3.4 (latest) — 2025-11-17
- 1.3.3 — 2022-10-19
- 1.3.2 — 2022-09-29
- 1.3.1 — 2022-09-29
- 1.3.0 — 2022-09-29
- 1.2.3 — 2022-07-26
- 1.2.2 — 2020-03-25
- 1.2.1 — 2019-02-14
- 1.2.0 — 2019-02-14
- 1.1.3 — 2019-01-28
- 1.1.2 — 2018-12-06
- 1.1.1 — 2018-09-27
- 1.1.0 — 2018-08-29
- 1.0.21 — 2018-08-29
- 1.0.20 — 2018-08-29
- … 20 more at https://npm.io/package/vue-yp-http/versions

## README

# VUE-YP-HTTP

基于axios使用在vue上的HTTP组件，根据YP业务二次封装。

## Installing
Using yarn:
```
$ yarn add vue-yp-http
```

## Example

Use in Vue
```
    import YpHttp from 'vue-yp-http';

    Vue.use(YpHttp, {
        method: '$yphttp', // custom invoke method name, default $http, recommended use default value
        path: '/api', // set global request path
    });


    // in vue scope
    ...
    
    this.$
    
    ...


```

Performing a `POST` request, `$http.post(method, {params}, {options})`
```
    // method, biz_method
    // params，biz_content
    this.$http.post(method, {params})
        .then(resp=>{
            console.log(resp.data);
        }).catch(err=>{
            console.log(err);        
        });
```

Performing a `UPLOAD`  `POST` request, `$http.upload({params}, {options})`
```
    this.$http.upload({
        method: '', // biz_method
        UploadFile: ''
    }).then(resp=>{
        console.log(resp.data);
    }).catch(err=>{
        console.log(err);        
    });
```

Performing a `DOWNLOAD`  `POST` request, `$http.download(method,{params}, {options})`
```
    this.$http.download(
        method, // biz_method
        params, // biz_content
    ).then(resp=>{
            console.log(resp.data);
        }).catch(err=>{
            console.log(err);        
        });
```

Performing a `DOWNLOADFILE`  `POST` request, `$http.downloadFile(method,{params})`, use post method to submit a form, than download a file
```
    this.$http.downloadFile(
        method, // biz_method
        params, // biz_content
    )
```

---
_Source: https://npm.io/package/vue-yp-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
