vue-yp-http
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
@mundoit-lib/plugin-vue-axios
Vue 3 plugin for a shared Axios instance (JSON headers, multi-database base URL,...
1,637
0
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 | |
| 1.2.3 | MIT | |
| 1.2.2 | MIT | |
| 1.2.1 | MIT | |
| 1.2.0 | MIT | |
| 1.1.3 | MIT | |
| 1.1.2 | MIT | |
| 1.1.1 | MIT | |
| 1.1.0 | MIT | |
| 1.0.21 | MIT | |
| 1.0.20 | MIT | |
| 1.0.19 | MIT | |
| 1.0.18 | MIT | |
| 1.0.17 | MIT | |
| 1.0.16 | MIT | |
| 1.0.15 | MIT | |
| 1.0.14 | MIT | |
| 1.0.13 | MIT | |
| 1.0.12 | MIT | |
| 1.0.11 | MIT | |
| 1.0.10 | MIT | |
| 1.0.9 | MIT | |
| 1.0.8 | MIT | |
| 1.0.7 | MIT | |
| 1.0.6 | MIT | |
| 1.0.5 | MIT |
Showing the latest 30 of 35. See every release on npm