HTML部分
<div class="commodity-details" ref="commodityDetails"></div>
js部分
window.scrollTo({
top: this.$refs['commodityDetails'].getBoundingClientRect().top + window.scrollY-70,
behavior: 'smooth' // 平滑滚动
})
HTML部分
<div class="commodity-details" ref="commodityDetails"></div>
js部分
window.scrollTo({
top: this.$refs['commodityDetails'].getBoundingClientRect().top + window.scrollY-70,
behavior: 'smooth' // 平滑滚动
})