better-mock fork from Mock.js, the usage method is the same as Mock.js, used for javascript mock data generation, it can intercept XHR
and fetch
requests, and return custom data types. And it also supports mainstream mini programs (WeChat, Alipay, Toutiao, Baidu).
Document introduction
Change log
Mock.js is a very good library with many users in China. Although the library has almost stopped maintaining, there are still many users raising issues and PRs, but these problems have not been effectively solved. Moreover, in the current era, the construction tools and code quality of Mock.js are very outdated, so better-mock
will iterate on the basis of Mock.js, continue to fix many issues of Mock.js, and support more new ones. characteristic.
typescript
, better code tips.fetch
.npm install better-mock
Use better-mock
instead of mockjs
.
const Mock = require ( 'better-mock' )
Mock . mock ( {
'list|1-10' : [ {
'id|+1' : 1
} ]
} )
If you want to contribute your own code to better-mock
, please read this contribution guide carefully first.
Mock.js is available under the terms of the MIT License.