【问题标题】:How to extend span-method for different tables如何为不同的表扩展跨度方法
【发布时间】:2019-04-02 07:41:26
【问题描述】:

我动态生成一组卡片。每张卡片都会生成一组桌子。每个表都会有不同的行跨度效果。我写了下面的代码,显然所有的表都会调用同一个方法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>

【问题讨论】:

    标签: vue.js element-ui


    【解决方案1】:

    谢谢丹! 我找到了另一种方法来做到这一点。以下代码仅供参考。

    :span-method="objectSpanMethod(i)"
    
     objectSpanMethod(idx) {
      return ({ row, column, rowIndex, columnIndex })=>{
         console.log(row, column, rowIndex, columnIndex)
         console.log(idx)
      }  
     } 
    

    【讨论】:

      猜你喜欢
      • 2019-09-21
      • 2011-12-19
      • 1970-01-01
      • 2021-03-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多