ci-network
v0.0.8
Published
中台网络库
Downloads
30
Readme
ci-network
a vue2.0 network library based on IDG
Language
Install
$ npm install ci-network --save-devupdate
$ npm update ci-network --save-devWhat's Library Included
Usage
// import
import CINetwork from 'ci-network'
Vue.use(CINetwork)Apis
createApi(url, params):postrequest- added in vue prototype, in components you can use
this.$createApi empty stringnullundefindwill be filter- encapsulation by
promise, it willrejectin these cases:- return null
- return value is not
jsonobject - return
retin value is not1 - request timeout default time is
10s - request error
example
// in global
CINetwork.createApi(url, params)
// in components createApi added in vue prototype
this.$createApi(url, params)
.then(res => {
})
.catch(error => {
// error
})
example
// example in components
this.$http.get(url, params, option)
.then(res => {
})
.catch(error => {
})
this.$http.post(url, params, option)
.then(res => {
})
.catch(error => {
})