滚动定位到指定位置

【滚动定位到指定位置】const flowDetailDivMenu = document.getElementById("flowDetailDivMenu");

const approveListDivMenu = document.getElementById("approveListDivMenu"); let detailBoxDivTop = flowDetailDivMenu ? flowDetailDivMenu.offsetTop : 0; let approveDivTop = approveListDivMenu ? approveListDivMenu.offsetTop : 0; setTimeout(() => { //-10是为了上边留一点白色间距 if (key === "detail") { window.scrollTo({ top: detailBoxDivTop-10, // this.heightToTop(document.getElementById("flowDetailBox")), behavior: "instant" }); } else if (key === "myCare") { window.scrollTo(0, 0); } setTimeout(() => { window.addEventListener("scroll", this.myMenuTopScroll); }, 280); }, 10);

    推荐阅读