vite搭建的项目,使用mockjs模拟数据,怎么模拟延迟响应,例如 200ms后返回数据
import { MockMethod } from 'vite-plugin-mock'
const Mock = require('mockjs');
const mockApi = [
{
url: '/mock/getList',
method: 'get',
response: ({ query }, res) => {
console.log(query, 'query')
return Mock.mock({
code: 0,
'data|15': [
{
'id|+1': 1,
name: '@string("upper", 5)',
'status|1-3': 3,
time: '@datetime',
},
],
})
},
}
] as MockMethod[]
export default mockApi