2021-10-20 06:32:09 +00:00
|
|
|
import { MockMethod } from 'vite-plugin-mock';
|
2022-03-10 01:47:29 +00:00
|
|
|
import { resultSuccess, baseUrl } from '../_util';
|
2021-10-20 06:32:09 +00:00
|
|
|
|
2022-03-10 01:47:29 +00:00
|
|
|
const demoList = (keyword, count = 20) => {
|
2021-10-20 06:32:09 +00:00
|
|
|
const result = {
|
|
|
|
list: [] as any[],
|
|
|
|
};
|
2022-03-10 01:47:29 +00:00
|
|
|
for (let index = 0; index < count; index++) {
|
2021-10-20 06:32:09 +00:00
|
|
|
result.list.push({
|
|
|
|
name: `${keyword ?? ''}选项${index}`,
|
|
|
|
id: `${index}`,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
|
|
|
|
export default [
|
|
|
|
{
|
2022-03-10 01:47:29 +00:00
|
|
|
url: `${baseUrl}/select/getDemoOptions`,
|
2021-10-20 06:32:09 +00:00
|
|
|
timeout: 1000,
|
|
|
|
method: 'get',
|
|
|
|
response: ({ query }) => {
|
2022-09-22 06:05:12 +00:00
|
|
|
const { keyword,count} = query;
|
2021-10-20 06:32:09 +00:00
|
|
|
console.log(keyword);
|
2022-09-22 06:05:12 +00:00
|
|
|
return resultSuccess(demoList(keyword,count));
|
2021-10-20 06:32:09 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
] as MockMethod[];
|