阅读 186

table表格长度超出屏幕范围,可滑动

table表格长度超出屏幕范围,可滑动

步骤:

1、将table表格用div标签包裹起来

2、设置div的style="overflow:auto;width:100%"

3、设置table的style="white-space:nowrap"

复制代码

<template>
  <div>
    <div class="container">
      <p>整体情况<van-button type="primary" @click="toExcel()">导出为Excel</van-button></p>
      <div style="overflow:auto;width:100%">
         <table border="2" class="tabStyle">
             <tr>
                 <th>部门名称</th>
                 <th>已对接证件类型数</th>
                 <th>待对接证件类型数</th>
                 <th>本月入库证件数</th>
                 <th>累计入库证件数</th>
                 <th>累计质检入库率</th>
             </tr>
             <tr>
                 <td>111111111111</td>
                 <td>2</td>
                 <td>3</td>
                 <td>4</td>
                 <td>5</td>
                 <td>6</td>
             </tr>
         </table>
      </div>
      <a id="forExport" style="visibility: hidden" href="#"></a>
    </div>
    </div>
  </div></template><script></script><style scoped lang="less">
  .container{
    .tabStyle {      white-space:nowrap;
      tr {
        font-size: 10px;
        th {
          height: 40px;
          text-align: center;
          padding: 0 10px;
        }
        td {
          height: 40px;
          text-align: center;
        }
      }
      .secTable {
        th {
          padding: 0 10px;
        }
        td {
          padding: 0 10px;
        }
      }
      .lastTable {
        th {
          width: 130px;
        }
        td {
          width: 130px;
        }
      }
    }
  }
}</style>

复制代码

 

展示结果:超出屏幕宽度时,表格是可以在可视范围中移动的

  

来源:https://www.cnblogs.com/ibear/p/14792607.html

服务器评测 http://www.cncsto.com/ 

服务器测评 http://www.cncsto.com/ 


文章分类
后端
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐