Blame view

mock/table.js 540 Bytes
80a28914e   吉鹏   init
1
2
3
  import Mock from 'mockjs'
  
  const data = Mock.mock({
c44ba96f6   Adam   auto commit the c...
4
    'items|10': [{
80a28914e   吉鹏   init
5
      id: '@id',
c44ba96f6   Adam   auto commit the c...
6
      title: '@sentence(3, 10)',
80a28914e   吉鹏   init
7
      'status|1': ['published', 'draft', 'deleted'],
c44ba96f6   Adam   auto commit the c...
8
      author: 'name@integer(300, 5000)',
80a28914e   吉鹏   init
9
10
11
12
13
14
15
      display_time: '@datetime',
      pageviews: '@integer(300, 5000)'
    }]
  })
  
  export default [
    {
c44ba96f6   Adam   auto commit the c...
16
      url: '/yp/table/list',
80a28914e   吉鹏   init
17
18
19
20
21
22
23
24
25
26
27
28
29
      type: 'get',
      response: config => {
        const items = data.items
        return {
          code: 20000,
          data: {
            total: items.length,
            items: items
          }
        }
      }
    }
  ]