效果图
先上代码
table 组件中的代码 table.vue
<template>
<div>
<div :style="tableStyle" v-scrollX="this">
<div>
<div class="thead">
<div v-for="(item,index) in columns" :key="item+index" :style="styleObject(item,1)" >
<div :style="{...styleObject(item,2),'left':left+'px',background:'white'}" >
<div>{
{item.lable}}</div>
</div>
</div>
</div>
</div>
<div class="tbody" :style="tbodyStyle" v-if="dataList.length>0" @scroll="handleBodyScroll" >
<div v-for="(item,index) in data" :key="item+index" class="tbody-item" :style="{'borderBottom':border?'1px solid #dcdee0':'none'}" >
<div v-for="(items,indexs) in columns" :key="items+indexs" :style="styleObject(items,1)" >
<div :style="{...styleObject(items,2),'left':left+'px',background:'white'}" >
<div v-if="!items.render">{
{item[items.key]}}</div>
<render-template v-if="items.render" :render="items.render" :row="item" :index="index" :colu