
实现element-ui 的 el-table 表头自动吸顶功能(sticky)
实现el-table 表头自动吸顶在页面顶部,只需要在style中加上以下css即可,表头栏固定位置与顶部距离可以调整 top:0px 值达到合适位置
·
实现el-table 表头自动吸顶在页面顶部,只需要在style中加上以下css即可,表头栏固定位置与顶部距离可以调整 top:0px 值达到合适位置
/deep/ .el-table {
overflow: visible;
}
/deep/ .el-table__header-wrapper {
position: sticky;
top: 0px;
z-index: 10;
}
注:/deep/ 是elementUI样式穿透,VUE项目中如果style加了scoped属性,无法直接修改element样式,去掉scoped可以生效,但会影响全局,所以你需要根据自身项目情况,决定使用/deep/方式或者::v-deep方式,如有其它不懂,建议单独看一下CSS的样式穿透即可
更多推荐
所有评论(0)