How do I traverse an array of objects in an array in el-table?

using the Table component in element-UI, the requirement now is to traverse the array of objects in the array in the second level?

<el-table :data="applyList" style="width: 100%">
    <el-table-column label="">
        <template slot-scope="scope">
            <div>
                

<span>:</span> <span>:</span>

<span>:</span> <span>:</span>

<span>:</span> <span>:</span>

<span>:</span> <span>:</span>

</div> </template> </el-table-column> </el-table> <script> export default { data() { return { applyList: [], courseReportPeopleDtoList: [] }; }, created() { this.getApplyList(); }, methods: { // getApplyList() { let param = { courseId: this.ruleForm.courseId, courseName: this.ruleForm.courseName, lecturerName: this.ruleForm.lecturerName, page: this.ruleForm.page, pageSize: this.ruleForm.pageSize }; this.$http .get(this.$api.courseReportDetails, { params: param }) .then(res => { if (res.status == 200) { this.applyList = res.data.data.data; } }) .catch(err => { console.log(err); }); }, } }; </script>

data returned by background

clipboard.png

how do I render through the courseReportPeopleDtoList array?

Dec.03,2021

two v-for or you can extract this in then (), that is, the thing of two for loops


extract the courseReportPeopleDtoList array. V-for needs scope.row in the tag before it can be looped, otherwise it will always loop the array one layer up.

for (let i = 0; i < arr.length; iPP) {
  if(arr[i].courseReportPeopleDtoList) {
    this.courseReportPeopleDtoList = arr[i].courseReportPeopleDtoList
  }

<el-table-column label="">
    <template slot-scope="scope">
        <div v-for="(item, index) in scope.row.courseReportPeopleDtoList" :key="index">
            

<span>:</span> <span>{{ item.name }}</span>

<span>:</span> <span>{{ item.tel }}</span>

<span>:</span> <span>{{ item.rerolltime }}</span>

<span>:</span> <span>{{ item.identity }}</span>

</div> </template> </el-table-column>
Menu