| 1234567891011121314151617 |
- import Mock from 'mockjs-x'
- Mock.setup({
- timeout: '100-200'
- })
- // 遍历目录所有ts文件
- const files = require.context('.', false, /\.ts$/);
- files.keys().forEach((key) => {
- if (key !== './index.ts') {
- const list = files(key).default;
- list.forEach((req: { [key: string]: unknown }) => {
- Mock.mock(RegExp(req.url + '.*'), req.type, req.response);
- })
- }
- })
|