错误
vue中运用了Element-ui组件table,同时使用了v-for="(item,index) in mydata"
错误原因
table循环遍历的方式是如下所示的,有自己的规则
要么使用如下的遍历方式
如果你的tableData是如下所示,那么不需要prop怎么来循环遍历呢?
使用scope.row获取元素就可以了
要么使用以下的自定义遍历方式
<el-table
:data="data"
border
>
<el-table-column
prop="userName"
:label="$t('user.username')"
>
</el-table-column>
<!-- 自定义列的遍历-->
<el-table-column v-for="(item, index) in colunmName" :key="index" :label="item" >
<!-- 数据的遍历 scope.row就代表数据的每一个对象-->
<template slot-scope="scope">
<span>{{scope.row.list[index].value}}</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column
prop="Total"
:label="$t('ad.totalNumber')"
>
</el-table-column>
</el-table>