- Notifications
You must be signed in to change notification settings - Fork2.7k
mozhi.gyy edited this pageFeb 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()// => "x.davis@jackson.edu"Random.email('nuysoft.com')// => "h.pqpneix@nuysoft.com"
- Random.ip()
随机生成一个 IP 地址。
Random.ip()// => "34.206.109.169"
Mock.js 最初的灵感来自 Elijah Manor 的博文Mocking Introduction,语法参考了mennovanslooten/mockJSON,随机数据参考了victorquinn/chancejs。