goods.js 740 B

12345678910111213141516171819202122232425262728293031323334
  1. const List = [
  2. {
  3. uuid: "@uuid",
  4. icon: "file-pdf-line",
  5. title: "pdf打印",
  6. price: "0",
  7. type: "组件",
  8. isRecommend: 1,
  9. },
  10. ];
  11. module.exports = [
  12. {
  13. url: "/goods/getList",
  14. type: "get",
  15. response(config) {
  16. const { title, pageNo = 1, pageSize = 20 } = config.query;
  17. let mockList = List.filter((item) => {
  18. if (title && item.title.indexOf(title) < 0) return false;
  19. return true;
  20. });
  21. const pageList = mockList.filter(
  22. (item, index) =>
  23. index < pageSize * pageNo && index >= pageSize * (pageNo - 1)
  24. );
  25. return {
  26. code: 200,
  27. msg: "success",
  28. totalCount: mockList.length,
  29. data: pageList,
  30. };
  31. },
  32. },
  33. ];