在移动端中使用vxe-table当有横屏功能时,在安卓使用时滑动方向出现错误无法根据横屏后的滑动。
此时手写原生div制作table表格
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>tabletitle>
<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">IDdiv>
<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 `
${i + 1}
${v.name}
${v.phone}
${v.address}
${v.createTime}
`
}).join('')
script>
html>