1.0.2 • Published 4 years ago

hg-vue-http v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

hgVueHttp

Simple secondary encapsulation of HTTP request based on Vue resource plug-in, supporting params, JSON, formdatau, URL parameter transfer, etc

Install

npm install hg-vue-http

Usage

In the need to access the interface file to introduce:

import hgVueHttp from 'hg-vue-http'

vueHttp API:

Requests can be made by passing the relevant config to vueHttp.
   hgVueHttp.request({
        url:'url',
        data: { page: 1, pageSize: 10 },
        method: 'post',
        dataType:'json'
      }).then(res=>console.log(res))

Default

method:'get',
dataType:'params'

hgVueHttp.request({
                  url:'url',
                  data: { page: 1, pageSize: 10 }}
                ).then(res=>console.log(res))
 

button style Constructor Options

methoddataTypedataurl
getparamsdata接口地址
postjsonurl传参
putFormData
delete
...