acro.design.pro.vue 中新建的页面创建mock无效,是因为我直接复制的示例页面,要修改两个位置:首先是mock中匹配的url,其次是要mock/index.ts中import新创建的mock.ts路径。
要修改mock匹配的url:
Mock.mock(new RegExp('/api/students'), (params: GetParams) => { const { current = 1, pageSize = 10 } = qs.parseUrl(params.url).query; console.log(current); const p = current as number; const ps = pageSize as number; return successResponseWrap({ list: data.list.slice((p - 1) * ps, p * ps), total: 55, }); });
在mock/index.ts中import新建的mock
import '@/views/students/base-table/mock';