0.0.8 • Published 8 years ago

ci-network v0.0.8

Weekly downloads
-
License
MIT
Repository
-
Last release
8 years ago

ci-network

a vue2.0 network library based on IDG

Language

Chinese

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 will reject in these cases: - return null - return value is not json object - return ret in value is not 1 - 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
})
  • http:
    • axios Object, in components you can use this.$http
    • api same as axios

example

// example in components
this.$http.get(url, params, option)
.then(res => {
}) 
.catch(error => {
})

this.$http.post(url, params, option)
.then(res => {
})
.catch(error => {
})
0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago