select-demo.ts 567 B

12345678910111213141516171819202122232425262728
  1. import { MockMethod } from 'vite-plugin-mock';
  2. import { resultSuccess } from '../_util';
  3. const list: any[] = [];
  4. const demoList = (() => {
  5. const result = {
  6. list: list,
  7. };
  8. for (let index = 0; index < 20; index++) {
  9. result.list.push({
  10. name: `选项${index}`,
  11. id: `${index}`,
  12. });
  13. }
  14. return result;
  15. })();
  16. export default [
  17. {
  18. url: '/basic-api/select/getDemoOptions',
  19. timeout: 1000,
  20. method: 'post',
  21. response: ({ query }) => {
  22. console.log(query);
  23. return resultSuccess(demoList);
  24. },
  25. },
  26. ] as MockMethod[];