html
<div class="table-main" id="table" :class="{fixed:fixed}"></div>
js
document.addEventListener("scroll", this.getHeight);
getHeight() {
this.wheight = $(window).height() - 170;
var mTop = $('#table').offset();
var sTop = $(document).scrollTop();
if (mTop) {
this.scrolltop = mTop.top - 60;
if (mTop.top < sTop) {
this.fixed = true;
} else {
this.fixed = false;
}
} else {
this.fixed = false;
}
},
css
.fixed {
position: fixed;
top: 60px;
z-index: 100;
}