如何扩展不同表的跨度方法

时间:2019-04-02 07:41:27

标签: vue.js element-ui

我动态生成一组卡。每个卡将生成一组表。每个表将具有不同的行跨度效果。我在下面编写了代码,显然,所有表都将调用相同的方法objectSpanMethod。我想扩展跨度方法以添加一个参数来告诉不同的表。怎么样?

<el-card v-for="(f, i) in arrangedflightInDay" :key="f.id" :name="f.name" class="box-card" >
    <div class="clearfix">
        <el-table
            :data="arrangedPlanInDay[i].content"
            :span-method="objectSpanMethod"
            @selection-change="selectionRecords">
            <el-table-column type="selection" width="40">&nbsp;</el-table-column>
        </el-table>
    </div>
</el-card>

1 个答案:

答案 0 :(得分:0)

谢谢丹! 我找到了另一种方法。下面的代码仅供参考。

:span-method="objectSpanMethod(i)"

 objectSpanMethod(idx) {
  return ({ row, column, rowIndex, columnIndex })=>{
     console.log(row, column, rowIndex, columnIndex)
     console.log(idx)
  }  
 }