Blame view

mock/demo/select-demo.ts 612 Bytes
1
2
3
import { MockMethod } from 'vite-plugin-mock';
import { resultSuccess } from '../_util';
4
const demoList = (keyword) => {
5
  const result = {
vben authored
6
    list: [] as any[],
7
  };
8
  for (let index = 0; index < 20; index++) {
9
    result.list.push({
10
      name: `${keyword ?? ''}选项${index}`,
11
      id: `${index}`,
12
13
14
    });
  }
  return result;
15
};
16
17
18

export default [
  {
19
    url: '/basic-api/select/getDemoOptions',
20
    timeout: 1000,
21
    method: 'get',
22
    response: ({ query }) => {
23
24
25
      const { keyword } = query;
      console.log(keyword);
      return resultSuccess(demoList(keyword));
26
27
28
    },
  },
] as MockMethod[];