Check if a div has a scrollbar
var obj=document.getElementById("showDiv")
if(obj.scrollHeight>obj.clientHeight||obj.offsetHeight>obj.clientHeight){
document.getElementById("hiddenDiv").style.height="15pt";
console.log('该div有滚动条!')
}
In the vue project, the method of restoring the initial position of the scroll bar
this.$nextTick(()=>{
let dom = document.getElementById('addContent');
if(dom!==null){
dom.scrollTop = 0;
}
})