0.0.8 • Published 8 years ago
ci-network v0.0.8
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 usethis.$createApi
-empty string
null
undefind
will be filter - encapsulation bypromise
, it willreject
in these cases: - return null - return value is notjson
object - returnret
in value is not1
- request timeout default time is10s
- 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 => {
})