|
|
|
@@ -0,0 +1,96 @@ |
|
|
|
<!-- --> |
|
|
|
<template> |
|
|
|
<div class="user-info"> |
|
|
|
<div> |
|
|
|
<el-radio-group v-model="radio1"> |
|
|
|
<el-radio-button label="zh_CN">中文</el-radio-button> |
|
|
|
<el-radio-button label="en">英文</el-radio-button> |
|
|
|
</el-radio-group> |
|
|
|
<el-button type="primary" |
|
|
|
class="ml30" |
|
|
|
@click="getUserList">生成数据</el-button> |
|
|
|
</div> |
|
|
|
<el-table :data="list" |
|
|
|
style="width: 100%"> |
|
|
|
<el-table-column prop="name" |
|
|
|
label="姓名" |
|
|
|
width="280"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="email" |
|
|
|
label="邮箱" |
|
|
|
width="280"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="address" |
|
|
|
label="地址信息"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="desc" |
|
|
|
label="个人简介"> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import {fakerEN_US,fakerZH_CN} from '@faker-js/faker'; |
|
|
|
import Mock from "mockjs"; |
|
|
|
console.log("FA_CN",fakerZH_CN) |
|
|
|
export default { |
|
|
|
name: "UserInfo", |
|
|
|
props: {}, |
|
|
|
components: {}, |
|
|
|
data () { |
|
|
|
return { |
|
|
|
radio1: "zh_CN", |
|
|
|
list: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: {}, |
|
|
|
watch: {}, |
|
|
|
async created () { }, |
|
|
|
async mounted () { }, |
|
|
|
methods: { |
|
|
|
getUserList () { |
|
|
|
let list = []; |
|
|
|
for (let index = 0; index < 100; index++) { |
|
|
|
if (this.radio1 == 'zh_CN') { |
|
|
|
let address = `${Mock.Random.county(true).replaceAll(' ', '')}${fakerZH_CN.location.streetAddress()}` |
|
|
|
let item = { |
|
|
|
name: Mock.Random.cname(), |
|
|
|
email: fakerZH_CN.internet.email(), |
|
|
|
address: address, |
|
|
|
desc:Mock.Random.cparagraph( 2, 5 ) |
|
|
|
} |
|
|
|
list.push(item) |
|
|
|
} else { |
|
|
|
let address = `${fakerEN_US.location.streetAddress()}` |
|
|
|
let item = { |
|
|
|
name: Mock.Random.name(true), |
|
|
|
email: fakerEN_US.internet.email(), |
|
|
|
address: address, |
|
|
|
desc:fakerEN_US.lorem.paragraph({ min: 2, max: 5 }) |
|
|
|
} |
|
|
|
list.push(item) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.list = list; |
|
|
|
} |
|
|
|
}, |
|
|
|
filters: {} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<!-- 单页私有css --> |
|
|
|
<style scoped> |
|
|
|
.user-info { |
|
|
|
padding: 30px; |
|
|
|
background-color: #fff; |
|
|
|
border-radius: 4px; |
|
|
|
min-height: 600px; |
|
|
|
} |
|
|
|
.ml30 { |
|
|
|
margin-left: 30px; |
|
|
|
} |
|
|
|
</style> |
|
|
|
<!-- 页面css,单页应用时谨防css覆盖问题 --> |
|
|
|
<style> |
|
|
|
</style> |