-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Web
mozhi.gyy edited this page Feb 17, 2016
·
6 revisions
- Random.url()
- Random.url( protocol, host )
随机生成一个 URL。
指定 URL 协议。例如 http。
指定 URL 域名和端口号。例如 nuysoft.com。
Random.url()
// => "mid://axmg.bg/bhyq"
Random.url('http')
// => "http://splap.yu/qxzkyoubp"
Random.url('http', 'nuysoft.com')
// => "http://nuysoft.com/ewacecjhe"- Random.protocol()
随机生成一个 URL 协议。返回以下值之一:'http'、'ftp'、'gopher'、'mailto'、'mid'、'cid'、'news'、'nntp'、'prospero'、'telnet'、'rlogin'、'tn3270'、'wais'。
Random.protocol()
// => "ftp"- Random.domain()
随机生成一个域名。
Random.domain()
// => "kozfnb.org"- Random.tld()
随机生成一个顶级域名(Top Level Domain)。
Random.tld()
// => "net"- Random.email()
- Random.email( domain )
随机生成一个邮件地址。
指定邮件地址的域名。例如 nuysoft.com。
Random.email()
// => "[email protected]"
Random.email('nuysoft.com')
// => "[email protected]"
- Random.ip()
随机生成一个 IP 地址。
Random.ip()
// => "34.206.109.169"Mock.js 最初的灵感来自 Elijah Manor 的博文 Mocking Introduction,语法参考了 mennovanslooten/mockJSON,随机数据参考了 victorquinn/chancejs。