0.0.8 • Published 9 years ago
ci-network v0.0.8
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 usethis.$createApi-empty stringnullundefindwill be filter - encapsulation bypromise, it willrejectin these cases: - return null - return value is notjsonobject - returnretin 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 => {
})