1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| import { MockMethod } from 'vite-plugin-mock';
| import { resultSuccess } from '../_util';
|
| const demoTreeList = (keyword) => {
| const result = {
| list: [] as Recordable[],
| };
| for (let index = 0; index < 5; index++) {
| const children: Recordable[] = [];
| for (let j = 0; j < 3; j++) {
| children.push({
| title: `${keyword ?? ''}选项${index}-${j}`,
| value: `${index}-${j}`,
| key: `${index}-${j}`,
| });
| }
| result.list.push({
| title: `${keyword ?? ''}选项${index}`,
| value: `${index}`,
| key: `${index}`,
| children,
| });
| }
| return result;
| };
|
| export default [
| {
| url: '/basic-api/tree/getDemoOptions',
| timeout: 1000,
| method: 'get',
| response: ({ query }) => {
| const { keyword } = query;
| console.log(keyword);
| return resultSuccess(demoTreeList(keyword));
| },
| },
| ] as MockMethod[];
|
|