How to use mockjs

Comprehensive mockjs code examples:

How to use mockjs.mock:

106
107
108
109
110
111
112
113
114
115
    normal: counts[2],
    bad: counts[3]
  }
})

return Mock.mock({
  status: 200,
  message: 'OK',
  data: {
    base_param: baseParamData,

How to use mockjs.Random:

0
1
2
3
4
5
6
7
8
9
/** 
 * 模拟数据动态化,引入mockjs.js来处理
 * author: liaoyanli
 */
let Mock = require('mockjs');
var Random = Mock.Random;
export function setString() {
    Random.word(3, 8);
    return Mock.mock('@word(3, 8)');
}