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