原生table 固定表头笔记

 <table border style="width:100%;height:100%;" id="res_table">
              <thead style="">
                <tr style="background:rgb(204, 204, 204)">
                  <th style="padding:5px 0;text-align:center;min-width:130px;position:sticky;top:-2px;background:rgb(204, 204, 204)" v-for="(item,index) in columnsData" :key="index">{{item}}</th>
                </tr>
              </thead>
              <tbody v-if="tableData.length>0">
                <tr v-for="(item,index) in tableData" :key="index">
                  <td style="padding:5px;text-align:center;vertical-align:middle;white-space: nowrap;" v-for="(child,index) in item" :key="index">
                    <pre>{{child}}</pre>
                  </td>
                </tr>
              </tbody>
            </table>


版权声明:本文为qq_38388578原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。