0.0.10 • Published 4 years ago

api-mock-data v0.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

api-mock-data

安装

npm install api-mock-data --save

or

yarn add api-mock-data

示例

import apiMockData from 'api-mock-data'
let api = new apiMockData({
  id: '递增id',
  pid: '身份证',
  cname: '中文名',
  name: '英文名',
  ctitle: '中文标题',
  title: '英语标题',
  date: '日期',
  image: '图片',
  province: '省份',
  city: '城市',
  zip: '邮政编码',
  sex: '随机0到2数字',
  demo:(Random)=>{
    console.log('自定义mock')
    return Random.integer(0, 30)
  }
})

//获取列表
api.getList({ page: 2 })
  .then(res => {
    console.log('res', res)
  })

 //获取列表(条件查询)
api.getList({ page: 1,data:{ctitle:'张'} })
  .then(res => {
    console.log('res2', res)
  }) 

//获取详情
api.getDetails({id:1})
  .then(res=>{
    console.log('res3',res)
  })  
0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago