Mockjs simulates a custom array

when using mockjs to simulate an array of objects, you need to do this:

  1. the first object of the array is artificially controlled;
  2. The other object of the
  3. array is randomly generated.

but mock is the last Mock.mock (url, template) when rendering tempalte,
so I don"t know what to do

Aug.08,2021

[{a:1}, ...Mock.mock({
    'data|1-10': [{
        p: '@string'
    }]
}).data]
Menu