2020-12-27 22:25:35 +08:00
|
|
|
import { MockMethod } from 'vite-plugin-mock';
|
|
|
|
import { resultSuccess } from '../_util';
|
|
|
|
|
2021-10-16 21:25:57 +08:00
|
|
|
const demoList = (keyword, count = 20) => {
|
2021-06-14 22:10:41 +08:00
|
|
|
const result = {
|
2021-07-19 00:14:27 +08:00
|
|
|
list: [] as any[],
|
2021-06-14 22:10:41 +08:00
|
|
|
};
|
2021-10-16 21:25:57 +08:00
|
|
|
for (let index = 0; index < count; index++) {
|
2021-06-14 22:10:41 +08:00
|
|
|
result.list.push({
|
2021-07-08 02:46:15 +08:00
|
|
|
name: `${keyword ?? ''}选项${index}`,
|
2021-06-14 22:10:41 +08:00
|
|
|
id: `${index}`,
|
2020-12-27 22:25:35 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
return result;
|
2021-07-08 02:46:15 +08:00
|
|
|
};
|
2020-12-27 22:25:35 +08:00
|
|
|
|
|
|
|
export default [
|
|
|
|
{
|
2021-03-11 01:22:10 +08:00
|
|
|
url: '/basic-api/select/getDemoOptions',
|
2021-06-14 22:10:41 +08:00
|
|
|
timeout: 1000,
|
2021-07-08 02:46:15 +08:00
|
|
|
method: 'get',
|
2020-12-27 22:25:35 +08:00
|
|
|
response: ({ query }) => {
|
2021-10-16 21:25:57 +08:00
|
|
|
const { keyword, count } = query;
|
2021-07-08 02:46:15 +08:00
|
|
|
console.log(keyword);
|
2021-10-16 21:25:57 +08:00
|
|
|
return resultSuccess(demoList(keyword, count));
|
2020-12-27 22:25:35 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
] as MockMethod[];
|