26 Star 286 Fork 115

石头/js-demo

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
48.html 2.33 KB
一键复制 编辑 原始数据 按行查看 历史
石头 提交于 2022-11-16 12:32 +08:00 . 更新pdf预览
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>table</title>
<style>
body {
margin: 0;
}
.fixedTHead {
position: sticky;
top: 0;
z-index: 2;
border-bottom: 1px solid #ddd;
}
.fixedTHead .td {
font-weight: bold;
}
.fixedLeft {
position: sticky;
left: 0;
}
.table-group {
width: 100vw;
height: 100vh;
overflow: auto;
}
.table {
width: 1200px;
display: flex;
flex-direction: column;
}
.tr {
display: flex;
}
.td,.th {
background-color: #fff;
text-align: center;
padding: 10px;
font-size: 24px;
}
.flex1 {
flex: 1;
}
.flex2 {
flex: 1
}
.flex3{
flex: 2;
}
.flex4 {
flex: 5;
}
.flex5 {
flex: 2;
}
</style>
</head>
<body>
<div class="table-group">
<div class="table">
<div class="tr fixedTHead">
<div class="td flex1 fixedLeft">ID</div>
<div class="td flex2">名称</div>
<div class="td flex3">联系方式</div>
<div class="td flex4">地址</div>
<div class="td flex5">注册时间</div>
</div>
<div class="tbody" id="body1">
</div>
</div>
</div>
</body>
<script>
document.getElementById('body1').innerHTML = new Array(60).fill({
id: 1,
name: '章三',
phone: '199****9999',
address: 'xx省xx市xx区xx街道xx小区xx栋xx号',
createTime: '2020-02-22'
}).map((v, i) => {
return `<div class="tr">
<div class="fixedLeft flex1 td">${i + 1}</div>
<div class="td flex2">${v.name}</div>
<div class="td flex3">${v.phone}</div>
<div class="td flex4">${v.address}</div>
<div class="td flex5">${v.createTime}</div>
</div>`
}).join('')
</script>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/qxscj/js-demo.git
git@gitee.com:qxscj/js-demo.git
qxscj
js-demo
js-demo
master

搜索帮助