mock.js文档详解5及下载(Random中的Name,Web,Address种类函数)

8 篇文章 0 订阅

Mock.Random 是一个工具类,用于生成各种随机数据

var Random = Mock.Random

  • Name

/** 1.
 * @function Random.first()
 * @returns {string}
 * @description 随机生成英文名 
 */
Random.first() // hellen

/** 2.
 * @function Random.last()
 * @returns {string}
 * @description 随机生成英文姓
 */
Random.last() // mery

/** 3.
 * @function Random.name( middle? )
 * @param {boolean} middle=false 是否生成中间名
 * @returns {string}
 * @description 随机生成英文姓名
 */
Random.name() // hellen mery
Random.name(true) // hellen alex mery

/** 4.
 * @function Random.cfirst()
 * @returns {string}
 * @description 随机生成中文姓
 */
Random.cfirst() // 曹

/** 5.
 * @function Random.clast()
 * @returns {string}
 * @description 随机生成中文名
 */
Random.clast() // 艳

/** 5.
 * @function Random.cname()
 * @returns {string}
 * @description 随机生成中文姓名
 */
Random.clast() // 曹艳
  • Web

/** 1.
 * @function Random.url( protocol?, host? )
 * @param? {string} protocol 协议
 * @param? {string} host 域名和端口号
 * @returns {string}
 * @description 随机生成Url
 */
Random.url() //随机一个Url
Random.url("http") //随机一个http协议的Url
Random.url("http", "abc.com") //随机一个http://abc.com的Url

/** 2.
 * @function Random.protocol()
 * @returns {string}
 * @description 随机生成Url协议
 * 返回池 'http'、'ftp'、'gopher'、'mailto'、'mid'、'cid'、'news'、'nntp'、
 *          'prospero'、'telnet'、'rlogin'、'tn3270'、'wais'
 */
Random.protocol() //随机一个Url协议

/** 3.
 * @function Random.domain()
 * @returns {string}
 * @description 随机生成域名
 */
Random.domain() //随机一个域名 abc.com

/** 4.
 * @function Random.tld()
 * @returns {string}
 * @description 随机生成顶级域名
 */
Random.tld() //随机一个顶级域名 net

/** 5.
 * @function Random.email( domain? )
 * @param? {string} domain 域名
 * @returns {string}
 * @description 随机生成邮箱地址
 */
Random.email() //随机一个邮箱地址
Random.email("abc.com") //随机一个邮箱地址 a.dasdadsa@abc.com

/** 6.
 * @function Random.ip()
 * @returns {string}
 * @description 随机生成ip地址
 */
Random.ip() //随机一个ip地址 192.168.0.101
  • Address

/** 1.
 * @function Random.region()
 * @returns {string}
 * @description 随机生成中国的大区
 */
Random.region() // 华北

/** 2.
 * @function Random.province()
 * @returns {string}
 * @description 随机生成中国省(或直辖市、自治区、特别行政区)
 */
Random.province() // 辽宁省

/** 3.
 * @function Random.city( prefix? )
 * @param? {string} prefix=false 是否生成所属省份
 * @returns {string}
 * @description 随机生成市
 */
Random.province() // 丹东市
Random.province(true) // 辽宁省 丹东市

/** 4.
 * @function Random.county( prefix? )
 * @param? {string} prefix=false 是否生成所属省份,市
 * @returns {string}
 * @description 随机生成县
 */
Random.county() // 宽甸县
Random.county(true) // 辽宁省 丹东市 宽甸县

/** 5.
 * @function Random.zip()
 * @returns {string}
 * @description 随机生成邮编
 */
Random.zip() // 100000

mockjs下载,日期2021-12-07

链接:https://pan.baidu.com/s/1jlwMfmzQEVm6kegKO1DFzw
提取码:wskh

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

合法的咸鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值