常规的el-table表格,看官方文档示例就可以实现
就是在你想固定的列上加fixed
如果你固定的列不是最左边或最右边的,比如是第二列的,那你要把第一列和第二列都加个固定,单单给第二列加不起作用。
我这里封装了表格,用for循环循环出列表,加一个fixed,索引列也加一个fixed
<el-table-column width="60" label="序号" type="index" align="center" fixed>
<template slot-scope="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
</el-table-column>
父组件的columnOption数组中,给需要的列设为true