表格固定行固定列问题

效果图

代码:

1.第一部分:表格固定行:用合计行来实现

复制代码
<el-table
     class="fixedRowcol"
    :data="tableData"
    border
    show-summary
    sum-text="合计"
    ref="table"></el-table>

2.第二部分:表格固定列加按钮,watch实现

复制代码
watch: {
        tableData() {
            let _this = this;
            this.$nextTick(() => {
	            console.log(_this.$refs.table.$refs);
           	    let html = _this.$refs.table.$refs.rightFixedFooterWrapper
	            .querySelector(".el-table__footer")
	            .querySelectorAll("td")[6]
	            .querySelector(".cell");
	
	             html.innerHTML = "<el-button>查看</el-button>";
	             html.onclick = () => {}
            });
        },
},

3.第三部分:style样式修改(根据element-ui table的各个部分实现方式,层级结构)

复制代码
:deep(.el-table.fixedRowcol) {
	    display: flex;
   	    flex-direction: column;
   	    .el-table__body-wrapper{
		    order: 1;
		    height: calc(100% - 76px) !important;
	    }
    	.el-table__footer-wrapper{
		    min-height: 32px;
		    display: flex !important;
      		td.el-table__cell{
			    div{
          		    white-space: nowrap;
			    }
      		}
    	}
	    .el-table__fixed-body-wrapper {
		    top: 76px !important;
		    height: calc(100% - 76px) !important;
   	    }
	    .el-table__fixed-footer-wrapper {
		    display: block !important;
		    z-index: 4;
		    top: 42px !important;
		    td.el-table__cell{
			    div{
            	    white-space: nowrap;
			    }
            }
        }
}
相关推荐
代码小学僧1 分钟前
Vite 项目最简单方法解决部署后 Failed to fetch dynamically imported Error问题
前端·vue.js·vite
RoyLin2 分钟前
TypeScript设计模式:装饰器模式
前端·后端·typescript
掘金一周12 分钟前
Flutter Riverpod 3.0 发布,大规模重构下的全新状态管理框架 | 掘金一周 9.18
前端·人工智能·后端
一涯22 分钟前
页面出现空白区域
前端
spmcor1 小时前
MinIO本地对象存储部署指南
前端
少年纪1 小时前
前端用 pdf.js 将 PDF 渲染到 Canvas 再转图片,文字消失的坑
前端
RoyLin1 小时前
TypeScript设计模式:复合模式
前端·后端·typescript
我是天龙_绍1 小时前
CSS/JS/图片全挂了,部署后页面白屏/资源加载失败?这两个配置项坑了多少人!
前端
我的小月月1 小时前
SQLFE:网页版数据库(VUE3+Node.js)
前端·后端
小高0071 小时前
🌐ES6 这 8 个隐藏外挂,知道 3 个算我输!
前端·javascript·面试