vue实现垂直表头和多列垂直表头解决方案

<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>```
**有一些多列垂直逻辑现在还有一些不明白,毕竟不是专业前端,有更多结局方案的大佬请关注,给与小弟一些支持**附上效果图
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190726142317741.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzIzMDI3MjQ3,size_16,color_FFFFFF,t_70)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值