element plus+vue3项目出现两个表头以及内容多样

如图中这种表格使用element plus和vue3该如何实现   

element plus 默认的表格都是一个表头对应一个字段  但是组件内也有合并列以及合并行的属性,但是达不到想要的效果

这时候就需要用到template自定义插槽了   这边因为没有什么逻辑性 就直接展示代码了

html:

  <el-table :data="tableData" style="width: 100%" height="650">
                <el-table-column prop="Date" label="备注" width="100" fixed="left" align="center">
                    <template #header>
                        <div>日期</div>
                        <div>备注</div>
                    </template>
                    <template #default>
                        <div>2024-05-03</div>
                        <div style="color: #4da4ff" @click="AddRemark">添加备注</div>
                    </template>
                </el-table-column>
                <el-table-column
                    prop="Name"
                    label="新增用户累计充值"
                    width="150"
                    fixed="left"
                    align="center"
                >
                    <template #header>
                        <div>新增用户</div>
                        <div>累计充值</div>
                    </template>
                    <template #default>
                        <div>0</div>
                        <div>0</div>
                    </template>
                </el-table-column>
                <el-table-column align="center" width="180px" fixed="left">
                    <template #header>
                        <div>成本/回报率</div>
                        <div>用户成本/付费用户</div>
                    </template>
                    <!-- #default="scope" -->
                    <template #default>
                        <div class="flexBox">
                            <div class="NumText">0元</div>
                            <div class="iconEdit">
                                <el-icon :size="15" style="vertical-align: middle">
                                    <EditPen />
                                </el-icon>
                            </div>
                            <span class="solide">/</span>
                            <div class="NumCount">0.00%</div>
                        </div>
                        <div class="flexBottom">
                            <div>0.00</div>
                            <span class="solide">/</span>
                            <div>0.00</div>
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="Address" label="D85" align="center" width="130px">
                    <div class="flexBox">
                        <div>0元</div>
                        <span class="solide">/</span>
                        <div class="NumCount">0.00%</div>
                    </div>
                    <div class="flexBottom">
                        <div>0.00</div>
                        <span class="solide">/</span>
                        <div>0.00</div>
                    </div>
                </el-table-column>
                <el-table-column prop="Address" label="D86" align="center" width="150px">
                    <div class="flexBox">
                        <div>0元</div>
                        <span class="solide">/</span>
                        <div class="NumCount">0.00%</div>
                    </div>
                    <div class="flexBottom">
                        <div>0.00</div>
                        <span class="solide">/</span>
                        <div>0.00</div>
                    </div>
                </el-table-column>
</el-table>

css:

.flexBox {
    display: flex;
    justify-content: center;

    .NumText {
        margin: 0 2px;
    }

    .iconEdit {
        margin-top: -2px;
    }

    .solide {
        margin: 0 5px;
    }

    .NumCount {
        font-weight: bolder;
    }
}

.flexBottom {
    display: flex;
    justify-content: center;

    .solide {
        margin: 0 5px;
    }
}

.el-table__header-wrapper {
    background-color: #f5f7fa;
}

                

  • 9
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值