hg-vue-http
v1.0.2
Published
A Vue.js project
Downloads
3
Maintainers
Readme
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
method |dataType| data | url |
---- |----- | ----- | ------ |
get | params | data | 接口地址 |
post | json | 无 | url传参 |
put | FormData| |
delete |
... |