We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
模板有时候 并不是 那么 符合预期值, 所以想 动态 创建值, 类似
// 使用Mock.js var Random = Mock.Random; let result = { "name": Random.cname(), "city": Random.city() } out(result);
请问, 我如何实现?
The text was updated successfully, but these errors were encountered:
模板有时候 并不是 那么 符合预期值, 所以想 动态 创建值, 类似 // 使用Mock.js var Random = Mock.Random; let result = { "name": Random.cname(), "city": Random.city() } out(result); 请问, 我如何实现?
平时 用 Mockjs 多一点, 看了一下 大佬的 代码, fork了一下, 更改 了 部分 代码 可以 安装 w2 install whistle.fake 来代替 vase, 然后 就可以 使用
w2 install whistle.fake
vase
let obj = mock({ aa: "@email", bb: "@integer(10, 100)", cc: random.cname() }) let obj2 = { dd: random.county(true), ee: mock("@date") } Object.assign(obj, obj2); out(obj);
其中, mock 为 Mock.mock函数, random被 替换成了 Mock.Random函数
更改的文件有 如果有 其他 的需求, 可以 自行 再去 添加 修改
Sorry, something went wrong.
如果不影响之前的用法,也可以提 pr
No branches or pull requests
模板有时候 并不是 那么 符合预期值, 所以想 动态 创建值, 类似
请问, 我如何实现?
The text was updated successfully, but these errors were encountered: