错误

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>
 

技术
今日推荐
PPT
阅读数 121
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信