表格当中的每一条数据里都有这个数组 这个数组里的值是后面癌胚抗原等的数据
checkName是上面表头数据checkValue是表头对应的数据
<el-table
:data="params.tableData"
border highlight-current-row
@selection-change="handleSelectionChange"
v-loading="params.loading"
ref="multipleTable"
>
<el-table-column type="selection" align="center"></el-table-column>
<el-table-column prop="userName" label="姓名" align="center" fixed width="150" >
<template slot-scope="scope">
<span>{{scope.row.userName}}</span>
<el-tag type='primary' style="marginLeft:5px;cursor:pointer" @click='handleRouter(scope.row.userName,scope.row.mobile)'>患者影像</el-tag>
</template>
</el-table-column>
<el-table-column prop="mobile" label="联系电话" align="center" width="150"></el-table-column>
<el-table-column prop="gender" label="性别/年龄" align="center">
<template slot-scope="scope">
{{scope.row.gender}}/{{scope.row.age}}
</template>
</el-table-column>
<el-table-column prop="checkTime" label="检查时间" align="center" width="150"></el-table-column>
<el-table-column
v-for="(v,index) in params.tableData[0] && params.tableData[0].checkItems"
:key="index"
:prop="v.checkValue"
:label="v.checkName"
width="150">
</el-table-column>
<el-table-column label="详情" align="center" width="270" fixed="right">
<template slot-scope="scope">
<el-button type="primary" @click.stop="wayButton(scope, 'detail')" size="mini">查看检查单</el-button>
<el-button type="primary" @click.stop="wayButton(scope, 'update')" size="mini">修改</el-button>
<el-button @click.stop="handleDelete(scope.row.id)" size="mini">删除</el-button>
</template>
</el-table-column>
</el-table>
目前代码我获取了params.tableData[0]第一跳数据里的checkItems,
还有个问题就是每条数据都有这个表头数据 那10条数据不是重复了吗?尝试过scope,后端说处理不了让前端处理,求大神指点!!谢谢
利用params.tableData[0]循环生成表头,在scope里通过scope.$index可以获取到当前行索引,使用计算属性可以拿到你想要的数据;前提是循环出的表头必须相同