例如后端传来:
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210621141001521.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0FyZXNfX18=,size_16,color_FFFFFF,t_70)
发现里面有嵌套格式的数据,我们该如何渲染呢??下面上代码:
<template>
<el-table
:data="tableData"
stripe
style="width: 100%">
<el-table-column
label="ID"
prop="id">
</el-table-column>
<el-table-column
label="Name"
prop="username">
</el-table-column>
<el-table-column
label="权限"
prop="roles[0].nameZh">
</el-table-column>
<el-table-column
align="right">
</el-table-column>
</el-table>
</template>
<script>
export default {
data() {
return {
tableData: [],
}
},
methods: {
findAll(){
this.axios.get('http://localhost:8989/users').then(res=>{
this.tableData=res.data._embedded.users;
console.log(this.tableData);
})
},
},
created() {
this.findAll();
}
}
</script>
<style>
</style>