forked from wangjiadong/comp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
647 B
29 lines
647 B
1 year ago
|
import { MockMethod } from 'vite-plugin-mock';
|
||
|
import { resultSuccess, baseUrl } from '../_util';
|
||
|
|
||
|
const demoList = (keyword, count = 20) => {
|
||
|
const result = {
|
||
|
list: [] as any[],
|
||
|
};
|
||
|
for (let index = 0; index < count; index++) {
|
||
|
result.list.push({
|
||
|
name: `${keyword ?? ''}选项${index}`,
|
||
|
id: `${index}`,
|
||
|
});
|
||
|
}
|
||
|
return result;
|
||
|
};
|
||
|
|
||
|
export default [
|
||
|
{
|
||
|
url: `${baseUrl}/select/getDemoOptions`,
|
||
|
timeout: 1000,
|
||
|
method: 'get',
|
||
|
response: ({ query }) => {
|
||
|
const { keyword,count} = query;
|
||
|
console.log(keyword);
|
||
|
return resultSuccess(demoList(keyword,count));
|
||
|
},
|
||
|
},
|
||
|
] as MockMethod[];
|