elementui 动态table表头

复制代码
<el-table
      size="mini"
      :stripe="false"
      :header-cell-style="{'background':'#d3e0ff'}"
      :row-class-name="rowClass"
      :data="tableData"
      :span-method="objectSpanMethod"
      border
      style="width: 100%; margin-top: 20px">
      <template v-for="item in tableHeader">
        <el-table-column
            :fixed="item.key == 'itemNo' || item.key == 'itemName' || item.key == 'amount'"
            :key="item.key"
            :label="item.label"
            align="center">
          <template slot-scope="scope">
              <span>{{ scope.row[item.key] }}</span>
          </template>
        </el-table-column>
      </template>
    </el-table>
复制代码
复制代码
<script>
export default {
    data() {
      return {
        tableHeader:[{
            label:'项目编号',
            key:'itemNo'
        },......],
      };
    },
}
</script>    
复制代码

 

posted @   秃头的铲屎官  Views(603)  Comments(0Edit  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示