vue-yp-http

基于axios使用在vue上的HTTP组件,根据YP业务二次封装。
1,088
Install
npm install vue-yp-http
Latest Version:1.3.4
License:MIT
Last Updated:Nov 17, 2025
Links: npm
Maintainer: pandaj

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
    )

Related Packages

vue-axios-cors

This is http client vue.js plugin for cross origin access without preflight. It...

14,521 5
vue-plugin-axios

A wrapper for integrating axios to Vuejs

3,521 5
@mundoit-lib/plugin-vue-axios

Vue 3 plugin for a shared Axios instance (JSON headers, multi-database base URL,...

1,637 0
iot-axios2

kaifangpingtai-vue2

1,597
@epoundor/vue-fetch

The ultimate solution for making API calls in your Vue.js projects

1,592 7

Version History

Version Released License
1.3.4 MIT
1.3.3 MIT
1.3.2 MIT
1.3.1 MIT
1.3.0 MIT