表格固定行固定列问题

效果图

代码:

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 小时前
前端使用阿里云图形验证码;并且与安卓进行交互
android·前端·阿里云
G***E3162 小时前
前端GraphQLAPI
前端
lumi.2 小时前
Vue + Element Plus 实现AI文档解析与问答功能(含详细注释+核心逻辑解析)
前端·javascript·vue.js·人工智能
z***I3942 小时前
VueGraphQLAPI
前端
S***t7143 小时前
Vue面试经验
javascript·vue.js·面试
粉末的沉淀4 小时前
css:制作带边框的气泡框
前端·javascript·css
p***h6435 小时前
JavaScript在Node.js中的异步编程
开发语言·javascript·node.js
N***73855 小时前
Vue网络编程详解
前端·javascript·vue.js
e***71675 小时前
Spring Boot项目接收前端参数的11种方式
前端·spring boot·后端
程序猿小蒜5 小时前
基于springboot的的学生干部管理系统开发与设计
java·前端·spring boot·后端·spring