1.加入這個跳轉(zhuǎn)方法
//描點跳轉(zhuǎn)
scrollToAnchor = (anchorName) => {
if (anchorName) {
// 找到錨點
let anchorElement = document.getElementById(anchorName);
// 如果對應(yīng)id的錨點存在,就跳轉(zhuǎn)到錨點
if(anchorElement) { anchorElement.scrollIntoView({block: 'start', behavior: 'smooth'}); }
}
}
2.在要跳的div標(biāo)記id:'xxx'.
3.在對應(yīng)的按鈕上面執(zhí)行點擊方法