
mounted() { window.addEventListener("scroll", this.handleScroll); }, methods: { handleScroll() { let scrollY = window.scrollY; let scrollObj = document.querySelector(".practice-right"); if (scrollY > 358) { //这个358就是上面的距离 scrollObj.style.position = "fixed"; scrollObj.style.right = "150px"; scrollObj.style.top = "0"; } else { scrollObj.style.position = "static"; scrollObj.style.marginTop = "0"; } } }

