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.
39 lines
903 B
39 lines
903 B
2 years ago
|
import { MockMethod } from 'vite-plugin-mock';
|
||
|
import { resultSuccess, baseUrl } 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: `${baseUrl}/tree/getDemoOptions`,
|
||
|
timeout: 1000,
|
||
|
method: 'get',
|
||
|
response: ({ query }) => {
|
||
|
const { keyword } = query;
|
||
|
console.log(keyword);
|
||
|
return resultSuccess(demoTreeList(keyword));
|
||
|
},
|
||
|
},
|
||
|
] as MockMethod[];
|