表格固定行固定列问题

效果图

代码:

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;
			    }
            }
        }
}
相关推荐
xiaoxue..几秒前
React 手写实现的 KeepAlive 组件
前端·javascript·react.js·面试
摘星编程4 分钟前
在OpenHarmony上用React Native:自定义useHighlight关键词高亮
javascript·react native·react.js
hhy_smile6 分钟前
Class in Python
java·前端·python
小邓吖29 分钟前
自己做了一个工具网站
前端·分布式·后端·中间件·架构·golang
南风知我意95735 分钟前
【前端面试2】基础面试(杂项)
前端·面试·职场和发展
LJianK11 小时前
BUG: Uncaught Error: [DecimalError] Invalid argument: .0
前端
2601_949613021 小时前
flutter_for_openharmony家庭药箱管理app实战+用药知识详情实现
android·javascript·flutter
No Silver Bullet1 小时前
Nginx 内存不足对Web 应用的影响分析
运维·前端·nginx
一起养小猫1 小时前
Flutter for OpenHarmony 实战 表单处理与验证完整指南
android·开发语言·前端·javascript·flutter·harmonyos
weixin_395448911 小时前
main.c_cursor_0130
前端·网络·算法