最近在做电商类型的官网,希望实现的布局如下:有表头和表身,所以我首先想到的就是table表格组件。

表格组件中常见的就是:标题和内容一一对应:

像效果图中的效果,只用基础的表格布局是不行的,因此我想到了table表格中的展开功能:

然后通过:默认展开所有行

然后在里面的表格table中默认隐藏表头:

其他的则需要通过样式进行实现了

element-ui中table表格的嵌套(代码部分)

 <el-table v-bind:data="tableData" :default-expand-all="true" class="parentTable"
ref="multipleTable"
v-loading="loading"
element-loading-text="拼命加载中">
<el-table-column type="expand">
<template slot-scope="props">
<div class="conWrap" style="text-align: left;line-height: 16px;font-size: 14px;position: relative;top: -10px;">
<span>订单包号:{{props.row.OrderNo}}</span>
<span style="margin-left:42px;">付款时间:{{props.row.CreateTime}}</span>
</div>
<el-table v-bind:data="props.row.OrderDetails" :default-expand-all="true" stripe :show-header="false" class="childTable">
<el-table-column prop="PartNo" align="center"
label="产品型号"
width="180">
<template slot-scope="scope">
<div class="name-b">{{scope.row.PartNo}}</div>
</template>
</el-table-column>
<el-table-column prop="Mfg"
label="品牌" width="199">
<template slot-scope="scope">
<div class="name-b">{{scope.row.Mfg}}</div>
</template>
</el-table-column>
<el-table-column prop="Package"
label="封装" width="114">
<template slot-scope="scope">
<div class="name-b">{{scope.row.Package}}</div>
</template>
</el-table-column>
<el-table-column prop="miaoshu"
label="描述" width="300">
<template slot-scope="scope">
<div class="name-b" style="width:100%;">72MHZ 20KB 37 2V~3.6V-40°C~85°C(TA)</div>
</template>
</el-table-column>
<el-table-column prop="ProductNum" align="center" width="120"
label="申请数量">
<template slot-scope="scope">
<div class="name-b">{{scope.row.ProductNum}}</div>
</template>
</el-table-column>
<el-table-column prop="maxNum"
label="申请状态">
<template slot-scope="scope">
<div>
<el-popover trigger="hover" placement="right" v-if="scope.row.State==20||scope.row.State==40">
<p v-if="scope.row.State==20">失败原因: {{ scope.row.FailReason }}</p>
<p v-if="scope.row.State==40">物流信息: {{ scope.row.ExpressNo }}</p>
<div slot="reference" class="name-wrapper">
{{scope.row.State |fiterState(stateMenu)}}
<span v-if="scope.row.State==40" style="margin-left:14px;color:#B77C20;">物流信息</span>
<span v-if="scope.row.State==20" style="margin-left:14px;color:#B77C20;">查看原因</span>
</div>
</el-popover>
<div v-else>
{{scope.row.State |fiterState(stateMenu)}}
</div>
</div>
</template>
</el-table-column>
<el-table-column label="操作" width="162">
<template slot-scope="scope">
<div style="display:flex;">
<el-button type="text" size="small" v-on:click="cancel(scope.row)" v-if="scope.row.State==10||scope.row.State==20">取消</el-button>
<el-button type="text" size="small" v-on:click="sureHave(scope.row)" v-if="scope.row.State==40">确认收货</el-button>
</div>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<el-table-column label="产品型号" align="center" width="180"></el-table-column>
<el-table-column label="品牌" width="199"></el-table-column>
<el-table-column label="封装" width="114"></el-table-column>
<el-table-column label="描述" width="300"></el-table-column>
<el-table-column label="申请数量" align="center" width="120"></el-table-column>
<el-table-column label="申请状态"></el-table-column>
<el-table-column label="操作" align="center" width="118"></el-table-column>
</el-table>

最终效果图:

样式部分:

.el-table {
border-top: none !important;
} .el-table__expanded-cell {
padding: 0 !important;
} .tableWrap {
width: 100%;
} .el-tabs__nav-scroll {
padding: 0 20px;
box-sizing: border-box;
} .tableWrap .el-table {
width: 1240px;
margin: 0 auto;
} .el-icon.el-icon-arrow-right {
color: #fff;
} .el-table__row.expanded {
background: #fff !important;
position: relative !important;
top: -100px !important;
border: 1px solid red;
} .el-tabs__content {
display: none;
} .el-table__row.expanded > td {
padding: 7px 0;
} .el-table__row.expanded {
border: 1px solid #E5E5E5;
} .el-table__row.expanded:first-child {
border-bottom: none;
} .childTable .el-table__body {
border-top: 1px solid #E5E5E5;
} .childTable .el-table__row.expanded > td:first-child {
border-left: 1px solid #E5E5E5;
} .childTable .el-table__row.expanded > td:last-child {
border-right: 1px solid #E5E5E5;
} .el-tabs__header.is-top {
border-bottom: none;
} .childTable .el-table__header-wrapper {
display: none;
} .conWrap {
height: 44px;
background: #E5E5E5;
line-height: 44px;
padding-left: 10px;
font-size: 14px;
font-family: Microsoft YaHei;
line-height: 19px;
color: #333333;
} .conWrap > span {
line-height: 44px;
} .el-table .has-gutter .is-leaf {
position: relative !important;
left: -48px !important;
} .el-table .has-gutter .is-leaf:last-child {
position: relative !important;
left: 0px !important;
} .el-table__header-wrapper {
background: #EBEBEB;
} .el-table .has-gutter > tr > th {
background: #EBEBEB;
font-size: 14px;
font-family: Microsoft YaHei;
font-weight: bold;
line-height: 19px;
color: #333333;
}

数据结构

{
"Items":[
{
"OrderNo":"ICS-10390-1",
"ProductIds":"[646,309118,331385,331393,331394]",
"UserId":10390,
"Applicant":"( ̄▽ ̄*)b",
"ApplicantMobile":"18458192430",
"Receiver":"123",
"CompanyName":"卡卡卡卡卡12 32 26",
"Post":"高管",
"Industry":"工业设计",
"Purpose":"332",
"Province":"广东省",
"City":"广州市",
"Address":"123",
"ContactMobile":"18458192430",
"CreateTime":"2021/9/7 8:51",
"OrderDetails":[
{
"Id":1309,
"OrderNo":"ICS-10390-1",
"SupplierId":2,
"ProductId":331393,
"ProductNum":1,
"ExpressNo":null,
"SendTime":"",
"ReceiveTime":"",
"JpSkuNo":"JPC47B1332N331393",
"PartNo":"cs-454",
"Package":"21",
"Mfg":"Samsung(三星)",
"ProPics":"https://test-jpfile1.oss-cn-shenzhen.aliyuncs.com//IcMall/icmall/2021/4/30/2021043014452714515931.JPG",
"CreateTime":"2021/9/7 8:51",
"UpdateTime":"2021/9/7 8:51",
"IsDeleted":false,
"State":10,
"CheckTime":null,
"FailReason":null,
"SupplierName":"深圳前海宝利士科技有限公司",
"ExpressCompany":null,
"Ship":1
}
]
}
],
"Queryable":null,
"TotalCount":1,
"Msg":null
}

element-ui实现table表格的嵌套(table表格嵌套)功能实现的更多相关文章

  1. Element ui 2.8版本中的table树不能默认全展开解决方法

    方案一:这个方案有问题 <el-table ref="tableTreeRef" :data="tableDate" ...... </el-tab ...

  2. element ui table 导出excel表格

    https://blog.csdn.net/u010427666/article/details/79208145 vue2.0 + element UI 中 el-table 数据导出Excel1. ...

  3. element ui table(表格)点击一行展开

    element ui是一个非常不错的vue的UI框架,element对table进行了封装,简化了vue对表格的渲染. element ui表格中有一个功能是展开行,在2.0版本官网例子中,只可以点击 ...

  4. element UI table 过滤 筛选问题

    一.问提描述    使用elementUI table 官方筛选案例,发现筛选不是服务器端筛选,而是浏览器端对每一页进行单独筛选. 如何在服务器端筛选? 二.查询Element UI 官网table组 ...

  5. Vue+element ui table 导出到excel

    需求: Vue+element UI table下的根据搜索条件导出当前所有数据 参考: https://blog.csdn.net/u010427666/article/details/792081 ...

  6. Element UI table组件源码分析

    本文章从如下图所示的最基本的table入手,分析table组件源代码.本人已经对table组件原来的源码进行削减,源码点击这里下载.本文只对重要的代码片段进行讲解,推荐下载代码把项目运行起来,跟着文章 ...

  7. (Element UI 组件 Table)去除单元格底部的横线

    Element UI 组件 Table 有一个属性 border,添加它可以增加纵向边框,但是无法控制横线边框,因此即使是最简单的 el-table,也会包含一个底部横线. 这个底部横线其实是一个 b ...

  8. 普通element ui table组件的使用

    1.使用基础的element ui 的table的基础使用 首先,使用前要先引用element库到项目中,可以直接引入element的js和css或者在vue项目下按需加载不同的组件 废话不多说,直接 ...

  9. VUE -- 对 Element UI table中数据进行二次处理

    时间——日期 后台经常给我们返回的是 时间戳 (例如:1535620671) 这时候我们页面展现的时候需要将时间戳转换为我们要的格式 例如 (YYYY-MM-DD HH:mm:ss) 如果是在Elem ...

  10. 开源 UI 库中,唯一同时实现了大表格虚拟化和树表格的 Table 组件

    背景 有这样一个需求,一位 React Suite(以下简称 rsuite)的用户,他需要一个 Table 组件能够像 Jira Portfolio 一样,支持树形数据,同时需要支持大数据渲染. 截止 ...

随机推荐

  1. 鸿蒙应用开发从入门到入行 - 篇3:ArkUI布局基础与制作可交互页面

    鸿蒙应用开发从入门到入行 - 篇3:ArkUI布局基础与制作可交互页面 导读:在本篇文章里,您将掌握事件.装饰器.双向绑定等相关知识,并利用所学知识做一个待办列表的案例. 练手案例:登录界面 开始之前 ...

  2. mysql 创建字段createtime 自动添加时间

    1. 创建createtime字段 类型选为timestamp 2.  添加默认值 CURRENT_TIMESTAMP

  3. 实用干货分享(5)- Hive存储格式及压缩算法测试比对分析

    ​ ​编辑 Hive文件存储格式及优缺点 textfile 默认的文件格式,行存储.建表时不指定存储格式即为textfile,导入数据时把数据文件拷贝至hdfs不进行处理. 优点:最简单的数据格式,便 ...

  4. Spring完全注解开发

    注解的好处:如果管理很多的Bean,要求这些Bean都配置在applocationContext.xml文件中.用了注解之后,就不需要在xml文件中配置了,Spring提供了几个辅助类会自动扫描和装配 ...

  5. 【Java】【SpringBoot】CP02:单元测试

    This article is written by Xrilang(Chinese Name:萌狼蓝天) If you want find me ,You can contact me in Bil ...

  6. SprinfBoot报警告WARNING: An illegal reflective access operation has occurred

    警告如图所示,该警告是因为jdk版本太高(我用的是10.0,据说9.0的也会这样),具体的原理还没有研究,它不影响项目的正常运行,但是看着很糟心有木有~~~~ 解决方案是把项目jdk降低到1.8及以下 ...

  7. Qt编写的项目作品9-音频综合应用示例

    一.功能特点 自动计算音频振幅,绘制音频振幅曲线和音频数据曲线. 支持音频录制,可选音频输入设备.采样频率.通道等参数,Qt5默认保存wav格式,Qt6默认保存mp3格式,Qt6可选wma.aac等格 ...

  8. Slate文档编辑器-Decorator装饰器渲染调度

    Slate文档编辑器-Decorator装饰器渲染调度 在之前我们聊到了基于文档编辑器的数据结构设计,聊了聊基于slate实现的文档编辑器类型系统,那么当前我们来研究一下slate编辑器中的装饰器实现 ...

  9. 前端学习openLayers配合vue3(加载线上数据源)

    现在我们学习一下加载网上的线上数据再加上点矢量图层,紧接着上一步 关键代码 layers: [ //瓦片图层source第三方,或者自带的,地图的底层 new TileLayer({ // sourc ...

  10. 2021 年万圣节 Github 彩蛋

    记录每年 Github 万圣节彩蛋,也记录有来项目成长历程. 2021 万圣节彩蛋 2020 万圣节彩蛋