zoukankan      html  css  js  c++  java
  • 自定义<el-table-column> 数据格式:数组对象,且每条对象中有一个数组对象

    自定义el-table-column 后台的数据格式:数组对象,且每条对象中有一个数组对象

    一 数据格式:

     每条对象中goodsCategoryList的数据是一种类型。

    二 代码

    <el-table-column v-for="(item, index) in tableData[0].goodsCategoryList" :key="index" :label="item.attrName">
                    <!-- 数据的遍历  scope.row就代表数据的每一个对象-->
                    <template slot-scope="scope">
                      <span>{{scope.row.goodsCategoryList[index].attrValue}}</span>
                    </template>
                  </el-table-column>

    v-for="(item, index) in tableData[0].goodsCategoryList"
    遍历tableData[0].goodsCategoryList的目的:1 获取item,用于给表头赋值。
    2 获取index,作为下表,用于scope.row.goodsCategoryList[index].attrValue用

    本人亲测:

     

  • 相关阅读:
    JS制作图表
    把图片存入数据库
    .NET各种小问题
    JS各种小问题
    JS操作cookie
    JS处理Json数据
    git与svn的区别
    关于java中的一些循环
    java基础面试(上)
    Spring事务
  • 原文地址:https://www.cnblogs.com/mmzuo-798/p/14626515.html
Copyright © 2011-2022 走看看