当前位置: 首页 > news >正文

table表格合并,循环渲染样式

效果 

html 

<table><!-- 标题 --><tr><th colspan="100"><el-input style="width: 300px;" v-model="paymentForm.name"></el-input></th></tr><!-- 栏目 --><tr><th colspan="2"></th><th :colspan="item.child.length" v-for="item, i in paymentForm.titleX" :key="i">{{ item.name }}</th></tr><tr><th colspan="2">摘要</th><template v-for="item, i in paymentForm.titleX" :key="i"><th v-for="item, k in item.child" :key="k">{{ item }}</th></template></tr><!-- 数据内容 --><template v-for="item, i in paymentForm.titleY" :key="i"><!-- 单行展示 --><tr v-show="!item.child" class="red"><td colspan="2">{{ item.name }}</td><td v-for="arr, index in item.arr" :key="index"><el-input v-model="item.arr[index]"></el-input></td></tr><!-- 多行展示 --><tr v-for="item2, k in item.child" :key="k" v-show="item.child.length"><td v-if="k == 0" :rowspan="item.child.length">{{ item.name }}</td><td v-if="item.child.length">{{ item2.name }}</td><td v-for="arr, index in item2.arr" :key="index"><el-input v-model="item2.arr[index]"></el-input></td></tr></template>
</table>

js 

let paymentForm = ref({name: "账户变动情况",titleX: [{ name: '账号1', child: ['基本户建行', '一般户工行1', '一般户工行2', '一般户民生', '农商', '民生', '支付宝'] },{ name: '账号2', child: ['基本户', '支付宝'] },{ name: '账号3', child: ['基本户', '支付宝'] },],titleY: [{ name: '昨日结余', arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{name: '收入',child: [{ name: "订单回款", arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{ name: "利息", arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{ name: "其他", arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] }]},{ name: '收入合计', arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{name: '支出',child: [{ name: "工资", arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{ name: "社保", arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{ name: "还款", arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{ name: "其他", arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] }]},{ name: '支出合计', arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{ name: '本日余额', arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] },{ name: '合计', arr: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,] }]
})

 css

table {width: 100%;border: 1px solid #ccc;text-align: center;border-collapse: collapse;:deep(.el-input, .el-select, .el-range-editor .el-input__wrapper) {width: 100%;border: none !important;}:deep(.el-input__wrapper) {box-shadow: none !important;}tr {th {padding: 5px 0;border: 1px solid #ccc;text-align: center;min-width: 70px;}td {padding: 5px 0;border: 1px solid #ccc;text-align: center;min-width: 90px;}}.red {color: red;font-weight: 700;}
}

 

 

http://www.lqws.cn/news/179335.html

相关文章:

  • React项目的状态管理:Redux Toolkit
  • kubeadm安装k8s
  • 黄晓明新剧《潜渊》定档 失忆三面间谍开启谍战新维度
  • 极空间z4pro配置gitea mysql,内网穿透
  • pgsql:还原数据库后出现重复序列导致“more than one owned sequence found“报错问题的解决
  • 网页端 js 读取发票里的二维码信息(图片和PDF格式)
  • 32单片机——窗口看门狗
  • 五子棋测试用例
  • go语言学习 第6章:错误处理
  • 浏览器工作原理05 [#] 渲染流程(上):HTML、CSS和JavaScript是如何变成页面的
  • Java逻辑运算符常见错误分析与规避指南
  • 03 mysql 的环境搭建
  • 服务器磁盘空间被Docker容器日志占满处理方法
  • 服务器信任质询
  • 什么?连接服务器也能可视化显示界面?:基于X11 Forwarding + CentOS + MobaXterm实战指南
  • 服务器出现故障怎么办?快速排查与解决方法
  • PostgreSQL 的扩展pg_freespacemap
  • Linux操作系统之进程(五):初识地址空间
  • Edge(Bing)自动领积分脚本部署——基于python和Selenium(附源码)
  • 七、数据库的完整性
  • Codeforces EDU Round 179 A~D
  • PDF转Markdown/JSON软件MinerU最新1.3.12版整合包下载
  • HarmonyOS运动语音开发:如何让运动开始时的语音播报更温暖
  • Redis 主从 + 哨兵集群部署
  • 【HarmonyOS 5】出行导航开发实践介绍以及详细案例
  • 《深度探秘:Java构建Spark MLlib与TensorFlow Serving混合推理流水线》
  • 麒麟系统使用-进行.NET开发
  • 电脑开不了机,主板显示67码解决过程
  • vue项目引入tailwindcss
  • 华为 “一底双长焦” 专利公布,引领移动影像新变革