有什么方法可以使用 vue 获取表格的列号或位置以及行标题吗?
到目前为止的输出是这样的。
生成表格的代码:
<table v-if="this.itemList.length > 0">
<thead class="ui-table-header-row">
<tr>
<th class="ui-table-header-cell l-padding"></th>
<th class="ui-table-header-cell center" v-for="item in 31" :key="item.id">{{thisMonth}} July{{ item }}Day</th>
</tr>
</thead>
<template>
<tr>
<td></td>
</tr>
<tbody style="border-bottom:#dbb100 1px" v-for="(item,index) in itemList" :key="index.id" >
<tr class="left-align">
<td>{{item.name}}</td>
<td v-for="(item,index) in costList" :key="index.id">{{item.total_work}}</td>
</tr>
</tbody>
</template>
</table>
在这一行上<td v-for="(item,index) in costList" :key="index.id">{{item.total_work}}</td>
,我必须先检查行标题名称是否与我item.name
的 in匹配,costList
然后再显示该值。我在这里找到了一些接近我想要的输出,但我不知道如何使用 vue 重现它。任何输入表示赞赏。