为了方便测试 前期需要显示假数据
可以使用下面的库
https://github.com/Marak/faker.js
网页端生成
<script src="https://github.com/Marak/faker.js" type = "text/javascript"></script>
<script>
//中文支持
faker.locale = "zh_CN";
var randomName = faker.name.findName();
var randomEmail = faker.internet.email();
var randomCard = faker.helpers.createCard();
</script>
node端引入
var faker = require('faker');
//中文支持
var faker = require('faker/locale/zh_CN');
var randomName = faker.name.findName();
var randomEmail = faker.internet.email();
var randomCard = faker.helpers.createCard();
类型 | 方法 |
---|---|
地址 address | zipCode city cityPrefix citySuffix streetName streetAddress streetSuffix streetPrefix secondaryAddress county country countryCode state stateAbbr latitude longitude |
商务 commerce | color department productName price productAdjective productMaterial product |
公司 company | suffixes companyName companySuffix catchPhrase bs catchPhraseAdjective catchPhraseDescriptor catchPhraseNoun bsAdjective bsBuzz bsNoun |
数据库 database | column type collation engine |
金融 finance | account accountName mask amount transactionType currencyCode currencyName currencySymbol bitcoinAddress iban bic |
日期 date | past future between recent month weekday |
图片 image | image avatar imageUrl abstract animals business cats city food nightlife fashion people nature sports technics transport dataUri |
互联网 internet | avatar exampleEmail userName protocol url domainName domainSuffix domainWord ip ipv6 userAgent color mac password |
句子 lorem | word words sentence slug sentences paragraph paragraphs text lines |
名称 name | firstName lastName findName jobTitle prefix suffix title jobDescriptor jobArea jobType |
号码 phone | phoneNumber phoneNumberFormat phoneFormats |
随机数 random | number arrayElement objectElement uuid boolean word words image locale alphaNumeric |
系统 system | fileName commonFileName mimeType commonFileType commonFileExt fileType fileExt directoryPath filePath semver |