<template>
<div class="table">
<table class="mailTable" :style="styleObject" v-if="s_showByRow" border="1" cellspacing="0" cellpadding="0" >
<tr ><th colspan="4">准入文件管理</th></tr>
<tr v-for="index in rowCount" v-bind:key="index">
<td >{{tableData2[index*2-2].key}}</td>
<td>{{tableData2[index*2-2].value}}</td>
<td >{{tableData2[index*2-1] !== undefined ? tableData2[index*2-1].key : ''}}</td>
<td>{{tableData2[index*2-1] !== undefined ? tableData2[index*2-1].value : ''}}</td>
</tr>
<tr ><th colspan="4">准入条件</th></tr>
<tr v-for="(item,index) in tableData3" :key="index">
<td >{{item.key}}</td>
<td colspan="3">{{item.value}}</td>
</tr>
</table>
</div>
</template>
<script>
export default {
data() {
return {
styleObject: {},
s_showByRow: true,
tableData2: [
{key: '文件名称', value: ''},
{key: '批次', value: ''},
{key: '文件类型', value: ''},
{key: '发文时间', value: ''},
{key: '所属市场', value: ''},
{key: '发文单位', value: ''},
{key: '操作人', value: ''},
{key: '操作时间', value: ''},
{key: '附件', value: ''},
],
tableData3: [
{key: '条件1', value: ''},
{key: '条件2', value: ''},
{key: '条件3', value: ''},
{key: '条件4', value: ''},
]
};
},
computed: {
rowCount: function() {
return Math.ceil(this.tableData2.length/2);
},
},
created() {
this.styleObject = this.tableStyle;
if(this.showByRow !== undefined){
this.s_showByRow = this.showByRow;
}
},
}
</script>
<style>
td{
width: 180px;
height: 42px;
background:white;
}
tr{
height: 42px;
background: #F0F8FA;
}
table{
margin: 0 auto;
border-collapse:collapse;
}
</style>```
**有一些多列垂直逻辑现在还有一些不明白,毕竟不是专业前端,有更多结局方案的大佬请关注,给与小弟一些支持**附上效果图

vue实现垂直表头和多列垂直表头解决方案
最新推荐文章于 2025-03-05 13:42:05 发布