watch.js 596B

12345678910111213141516171819202122232425262728293031
  1. import Mock from 'mockjs'
  2. import { param2Obj } from '@/utils'
  3. const List = []
  4. const count = 10
  5. for (let i = 0; i < count; i++) {
  6. List.push(Mock.mock({
  7. id: '@increment',
  8. number: +Mock.Random.date('T'),
  9. name: '赵日天',
  10. }))
  11. }
  12. export default {
  13. getList: config => {
  14. const {page = 1, limit = 20 } = param2Obj(config.url)
  15. let mockList = List.filter(item => {
  16. return true
  17. })
  18. const pageList = mockList.filter((item, index) => index < limit * page && index >= limit * (page - 1))
  19. return {
  20. total: mockList.length,
  21. items: pageList
  22. }
  23. }
  24. }