Mock.Random 是一个工具类,用于生成各种随机数据
var Random = Mock.Random
/** 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() // 曹艳
/** 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
/** 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