ci-network
v0.0.8
Published
中台网络库
Downloads
1
Readme
ci-network
a vue2.0 network library based on IDG
Language
Install
$ npm install ci-network --save-dev
update
$ npm update ci-network --save-dev
What's Library Included
Usage
// import
import CINetwork from 'ci-network'
Vue.use(CINetwork)
Apis
createApi(url, params)
:post
request- added in vue prototype, in components you can use
this.$createApi
empty string
null
undefind
will be filter- encapsulation by
promise
, it willreject
in these cases:- return null
- return value is not
json
object - return
ret
in 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 => {
})