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

手写table表格(一表头多数据)

手写table表格(一表头多数据)

<template><div class="table-info"><div class="info-list"><div class="header-wrapper"><div class="columns-title" v-for="(i, k) in columns" :key="k" :style="'width:' + i.width + 'px'"><div :class="[i.child ? 'active' : '']" v-html="i.name"></div><!-- <div v-if="i.child" class="line"></div> --><div v-if="i.child" class="column-warpper"><div class="column-subtitle" v-for="(child, cindex) in i.child" :key="cindex":style="'width:' + child.width + 'px'" v-html="child.name"></div></div></div></div><div class="content-data" v-for="(item, index) in dataList" :key="index"><div class="columns-text" v-for="(data, dindex) in item.data" :key="dindex":style="'width:' + dataWidth[dindex] + 'px'" v-html="data"></div></div></div></div>
</template><script>
export default {name: 'table-info',props: {columns: {type: Array,default: []},dataWidth: {type: Array,default() {return []}},dataList: {type: Array,default() {return []}}},data() {return {}}
}
</script><style scoped>
.table-info {width: 100%;/* width: 1600px; */
}.info-list {display: inline-block;margin-bottom: 20px;
}.header-wrapper {height: 70px;line-height: 70px;background: #4b82e9;font-size: 16px;color: #ffffff;/* margin-bottom: 10px; */text-align: left;border: 1px solid black;border-right: none;
}.header-wrapper>.columns-title {text-align: center;/* margin-right: 4px; */display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;position: relative;height: 70px;border-right: 1px solid black;}.header-wrapper>.columns-title>.active {line-height: 36px;border-bottom: 1px solid black;
}.line {height: 1px;background-color: rgba(0, 0, 0, 0.3);
}.column-warpper {position: absolute;bottom: 0;line-height: 20px;
}.column-subtitle {text-align: center;/* margin-right: 4px; */display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;height: 31px;border-right: 1px solid black;padding-top: 10px;position: relative;bottom: -3px;}/* 数值 */
.content-data {width: 100%;height: 27px;line-height: 27px;border: 1px solid black;border-top: none;border-right: none;
}.content-data>.columns-text {height: 100%;border-right: 1px solid black;text-align: center;display: inline-block;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;
}
</style>

数据格式

columns: [{ name: "浓度(μg/mL)", width: "180" },{name: "盐度S",width: "840",child: [{ name: '0', width: '120' },{ name: '3.5', width: '120' },{ name: '7', width: '120' },{ name: '14', width: '120' },{ name: '21', width: '120' },{ name: '28', width: '120' },{ name: '35', width: '120' },]},{ name: "最大相对偏差/%", width: "200" },],dataWidth: ['180', '120', '120', '120', '120', '120', '120', '120', '200'],dataList: [{data: ['0.4', '0.397', '0.417', '0.394', '0.397', '0.41', '0.387', '0.401', '4.2']},{data: ['2.2', '2.24', '2.21', '2.23', '2.25', '2.16', '2.16', '2.13', '3.2']}]
http://www.lryc.cn/news/303562.html

相关文章:

  • python3 flask 实现对config.yaml文件的内容的增删改查,并重启服务
  • ADO世界之“对象”
  • LeetCode59-螺旋矩阵II
  • MySQL 索引原理以及 SQL 优化
  • C++学习Day08之函数模板和普通函数的区别以及调用规则
  • Kaggle实践之《Home Credit Default Risk》的逐步优化
  • django rest framework 学习笔记-实战商城2
  • WEB 3D技术 three.js 3D贺卡(4) 添加鼠标滚轮移动屏幕 改变贺卡文字功能
  • 爬虫在网页抓取的过程中可能会遇到哪些问题?
  • Eclipse中Run As On Server和Run As Java Application
  • 【MySQL】库的操作——MySQL数据库 、库的操作、表的操作、字符集和校验规则、备份和恢复
  • pytorch 用F.normalization的逆归一化如何操作
  • LabVIEW多通道压力传感器实时动态检测
  • Jenkins解决Host key verification failed (2)
  • C#,数值计算,矩阵的乔莱斯基分解(Cholesky decomposition)算法与源代码
  • docker 备份 mysql
  • 使用C# Net6连接国产达梦数据库记录
  • docker (八)-dockerfile制作镜像
  • springcloud-网关(gateway)
  • 2.20 day2 QT
  • 【C++语法基础】4.分支和循环结构(✨新手推荐阅读)
  • 朋友圈程序全开源版源码,附带系统搭建教程
  • 思维方式系列文章目录 -《清单革命》实践
  • RAID 创建使用以及ubuntu安装和使用zfs文件系统及Ubuntu软件安装
  • yarn常用命令小记
  • 防御保护---内容保护
  • jquery将网页html文档导出为pdf图片
  • opengl 学习着色器
  • 【数据结构】18 二叉搜索树(查找,插入,删除)
  • 力扣日记2.20-【回溯算法篇】491. 非递减子序列